Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

jspÂÒÂë³õ¼¶½â¾ö·½°¸

×î»ù±¾µÄÂÒÂëÎÊÌâ
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
Html´úÂ룺
£¼%@ page language="java" pageEncoding="UTF-8"%£¾ 
£¼%@ page contentType="text/html;charset=iso8859-1"%£¾ 
£¼html£¾ 
£¼head£¾ 
£¼title£¾ÖÐÎÄÎÊÌ⣼/title£¾ 
£¼meta http-equiv="Content-Type" content="text/html; charset=UTF-8"£¾ 
£¼/head£¾ 
£¼/head£¾ 
£¼body£¾ 
ÎÒÊǸöºÃÈË 
£¼/body£¾ 
£¼/html£¾ 
Èý¸öµØ·½µÄ±àÂë
µÚÒ»¸öµØ·½µÄ±àÂë¸ñʽΪjspÎļþµÄ´æ´¢¸ñʽ¡£Ecljpse»á¸ù¾ÝÕâ¸ö±àÂë¸ñʽ±£´æÎļþ¡£²¢±àÒëjspÎļþ£¬°üÀ¨ÀïÃæµÄºº×Ö¡£
µÚ¶þ´¦±àÂëΪ½âÂë¸ñʽ¡£ÒòΪ´æΪUTF-8µÄÎļþ±»½âÂëΪiso8859-1£¬ÕâÑùÈçÓÐÖÐÎĿ϶¨³öÂÒÂë¡£Ò²¾ÍÊDZØÐëÒ»Ö¡£¶øµÚ¶þ´¦ËùÔÚµÄÕâÒ»ÐУ¬¿ÉÒÔûÓС£È±Ê¡Ò²ÊÇʹÓÃiso8859-1µÄ±àÂë¸ñʽ¡£ËùÒÔÈç¹ûûÓÐÕâÒ»ÐеĻ°£¬“ÎÒÊǸöºÃÈ˔Ҳ»á³öÏÖÂÒÂë¡£±ØÐëÒ»Ö²ſÉÒÔ¡£
µÚÈý´¦±àÂëΪ¿ØÖÆä¯ÀÀÆ÷µÄ½âÂ뷽ʽ¡£Èç¹ûÇ°ÃæµÄ½âÂ붼һÖ²¢ÇÒÎÞÎóµÄ»°£¬Õâ¸ö±àÂë¸ñʽûÓйØϵ¡£ÓеÄÍøÒ³³öÏÖÂÒÂ룬¾ÍÊÇÒòΪä¯ÀÀÆ÷²»ÄÜÈ·¶¨Ê¹ÓÃÄÄÖÖ±àÂë¸ñʽ¡£ÒòÒ³ÃæÓÐʱºò»áǶÈëÒ³Ã棬µ¼ÖÂä¯ÀÀÆ÷»ìÏýÁ˱àÂë¸ñʽ¡£³öÏÖÁËÂÒÂë¡£
±íµ¥Ê¹ÓÃPost·½Ê½Ìá½»ºó½ÓÊÕµ½µÄÂÒÂëÎÊÌâ
Õâ¸öÎÊÌâÒ²ÊÇÒ»¸ö³£¼ûµÄÎÊÌâ¡£Õâ¸öÂÒÂëÒ²ÊÇtomcatµÄÄÚ²¿±àÂë¸ñʽiso8859-1ÔÚµ·ÂÒ£¬Ò²¾ÍÊÇ˵postÌύʱ£¬Èç¹ûûÓÐÉèÖÃÌá½»µÄ±àÂë
¸ñʽ£¬Ôò»áÒÔiso8859-1·½Ê½½øÐÐÌá½»£¬½ÓÊܵÄjspÈ´ÒÔutf-8µÄ·½Ê½½ÓÊÜ¡£µ¼ÖÂÂÒÂë¡£¼ÈÈ»ÕâÑùµÄÔ­Òò£¬ÏÂÃæÓм¸ÖÖ½â¾ö·½Ê½£¬²¢±È½Ï¡£
a.
½ÓÊܲÎÊýʱ½øÐбàÂëת»»
String str = new String(request.getParameter("something").getBytes("ISO-8859-1"),"utf-8") £»
ÕâÑùµÄ»°£¬Ã¿Ò»¸ö²ÎÊý¶¼±ØÐëÕâÑù½øÐÐתÂë¡£ºÜÂé·³¡£µ«È·Êµ¿ÉÒÔÄõ½ºº×Ö¡£
b.
ÔÚÇëÇóÒ³ÃæÉÏ¿ªÊ¼´¦£¬Ö´ÐÐÇëÇóµÄ±àÂë´úÂë
request.setCharacterEncoding("UTF-8")
°ÑÌá½»ÄÚÈݵÄ×Ö·û¼¯ÉèΪUTF£­8¡£ÕâÑùµÄ»°£¬½ÓÊܴ˲ÎÊýµÄÒ³Ãæ¾Í²»±ØÔÚתÂëÁË¡£Ö±½ÓʹÓÃ
String str = request.getParameter("something")£»
¼´¿ÉµÃµ½ºº×Ö²ÎÊý¡£µ«Ã¿Ò³¶¼ÐèÒªÖ´ÐÐÕâ¾ä»°¡£Õâ¸ö·½·¨Ò²¾Í¶ÔpostÌá½»µÄÓÐЧ¹û£¬¶ÔÓÚgetÌá½»ºÍÉÏ´«ÎļþʱµÄenctype="multipart/form-data"ÊÇ


Ïà¹ØÎĵµ£º

JSP/FreeMarkerÉú³ÉRSS


¡¡¡¡ RSS2.0ÔÚÍøÂçÉÏ´óÐÐÆäµÀ,¸÷ÖÖÍøÕ¾¶¼¼ÓÉÏRSSÖ§³Ö,¹ØÓÚRSS¹æ·¶,¿ÉÒÔä¯ÀÀһϠhttp://blogs.law.harvard.edu/tech/rss
Ôڼƻ®Éú³ÉRSSÎļþµÄʱºò,˳±ãËÑË÷ÁËÒ»ÏÂJIRAºÍConfluenceµÄ³ÌÐò,·¢ÏÖËüÃÇ·Ö±ðÊÇÓÃÄ£°å·½Ê½ºÍJSP¶¯Ì¬Ò³ÃæÀ´Õ¹Ê¾µÄ.
ÓÚÊÇÎÒÒ²Ïëµ½Á½ÖÖ·½Ê½:
¡¡¡¡1.ÓÃFreeMarkerÉú³É¾²Ì¬Îļþ,ÊÊÓÃÓÚ¸üв ......

ÅäÖÃTOMCAT+ECLIPSE+MYSQLµÄJSP»·¾³

ÅäÖÃTOMCAT+ECLIPSE+MYSQLµÄJSP»·¾³
¹Ø¼ü´Ê£º JSP»·¾³ÅäÖà    TOMCAT+ECLIPSE+                                     &nbs ......

jsp Ìøת·½Ê½

ʹÓÃJSP´óÔ¼ÓÐÏÂÁÐÈýÖÖÌøת·½Ê½£º
1. response.sendRedirect();
2. response.setHeader("Location","");
3. £¼jsp:forward page="" /£¾
¾­¹ýÊÔÑéµÃµ½ÏÂÃæµÄһЩ¹æÔò£º
Ò». response.sendRedirect()
´ËÓï¾äÇ°²»ÔÊÐíÓÐout.flush()£¬Èç¹ûÓÐout.flush()£¬»áÓÐÒì³££º
java.lang.IllegalStateException: Can't send ......

ÔÚjspÒ³Ãæ¼ä´«µÝ²ÎÊý

£¨1£©Ö±½ÓÔÚURLÇëÇóºóÌí¼Ó
¡¡¡¡ È磺<a href="thexuan.jsp?action=transparams&detail=directe")Ö±½Ó´«µÝ²ÎÊý/a> 
¡¡¡¡ ÌرðµÄÔÚʹÓÃresponse.sendRedirect×öÒ³ÃæתÏòµÄʱºò£¬Ò²¿ÉÒÔÓÃÈçÏ´úÂ룺
¡¡¡¡ response.sendRedirect("thexuan.jsp?action=transparams&de ......

½â¾önetbeansдjsp³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌâ


jsp±íµ¥Ìá½»µÄÊý¾ÝÓÐÖÐÎÄʱ³öÏÖÂÒÂ룬²¢·Ç¶ÁÈ¡Êý¾Ý¿âÊý¾ÝºóÏÔʾÂÒÂ룬ÒÔÏÂÊǽâ¾öµÄ·½·¨¡£
netbeans´´½¨jspµÄÄ£°æÖÐÊÇ£º<%@page contentType="text/html" pageEncoding="UTF-8"%>£¬½«ÕâÐиijÉÒÔÏÂÕâÑù¾Í¿ÉÒÔÕý³£ÏÔʾÖÐÎÄ£º
<%@page language="java" pageEncoding=utf-8" %>
<%@page contentType=” ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ