½â¾öJspÒ³ÃæURLÖд«µÝ²ÎÊýÂÒÂëµÄ·½·¨
JspÒ³ÃæÔÚURLÖд«µÝ²ÎÊý»á³öÏÖÂÒÂë
½â¾ö·½·¨ÈçÏ£º
Ò»¡¢Ê¹Óøü¸ÄTomcatµÄ·½·¨¡£Õâ¸ö·½·¨¼òµ¥£¬µ«ÊÇÐèÒª¸Ä¶¯µÄµØ·½ÊÇ·þÎñÆ÷Èí¼þ¼¶±ðµÄ£¬Èç¹ûÉÔ΢±ä¶¯ÏµÍ³½«ÎÞ·¨ÕýȷתÂë£¬ÒÆÖ²ÐÔ²»¸ß¡£
1¡¢À´µ½tomcatĿ¼£¬ÕÒµ½confĿ¼ÏµÄserver.xmlÎʼۣ¬´ò¿ª£¬ÕÒµ½<Connector>±êÇ©£¬ÔÚ×îºóÌí¼ÓURIEncoding=’GBK’£¬Ð§¹ûÈçÏ£º
view plaincopy to clipboardprint?
<Connector
port="8080"maxThreads="150"minSpareThreads="25"maxSpareThreads="75"
enableLookups="false"redirectPort="8443"acceptCount="100"
debug="0"connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding=″GBK″/>
<Connectorport="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"enableLookups="false" redirectPort="8443" acceptCount="100"debug="0" connectionTimeout="20000"disableUploadTimeout="true" URIEncoding=″GBK″/>
ÕâÖÖ·½·¨¶ÔgetÕâ¸ö·½·¨²âÊԳɹ¦¡£
2¡¢ÔÚÿ¸öJspÒ³ÃæÌí¼ÓÈçÏ´úÂë
view plaincopy to clipboardprint?
<%@pagepageEncoding=”gb2312″%>
<%@pagecontentType=”text/html;charset=gb2312″%>
<%request.setCharacterEncoding(”gb2312″);%>
<%@ page pageEncoding=”gb2312″%><%@ page contentType=”text/html;charset=gb2312″%><%request.setCharacterEncoding(”gb2312″);%>
±àÂ뷽ʽҲ¿ÉÒԸijÉGBK£¬Ö§³Ö·±ÌåÖÐÎÄ¡£ÖØÆôTomcat£¬ÕâÒ»²½ºÜÖØÒª£¬·ñÔò¿ÉÄÜ¿´²»µ½Ð§¹û¡£
ÕâÖÖ·½·¨¶Ôpost²âÊԳɹ¦¡£½¨ÒéÁ½ÖÖͬ²½Ê¹Óá£
¶þ¡¢Ê¹ÓÃJSPµÄ£ó£ã£ò£é£ð£ôLet
view plaincopy to clipboardprint?
<%=newString(elValue.getBytes("iso-8859-1"),"GBK")%>
<%=new String(elValue.getBytes("iso-8859-1"),"GBK")%>
Èý¡¢Ê¹ÓÃ×Ô¶¨ÒåJSTL
ÕâÊÇÎÒÃǵÄÖØµãËùÔÚ,ÕâÀïÒªÏêϸ˵Ã÷.
µÚÒ»,±àд×Ô¶¨Òå±êÇ©
µÚ¶þ±àдtagÎļþ
µÚÈý²¿ÊðtagÎļþ
µÚËÄʹÓðÉ;)ºÜ¼òµ¥µÄ.
Ïà¹ØÎĵµ£º
'-------------------------------------------------------------------ÒÔÏÂÊǵǼ´úÂë
<%@ page contentType="text/html; charset=gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3 ......
ÔÚ¿ª·¢ÖÐÑéÖ¤ÂëÊDZȽϳ£Óõ½ÓÐЧ·ÀÖ¹ÕâÖÖÎÊÌâ¶Ôijһ¸öÌØ¶¨×¢²áÓû§ÓÃÌØ¶¨³ÌÐòÆÆ½â·½Ê½½øÐв»¶ÏµÄµÇ½³¢ÊԵķ½Ê½¡£
´ËÑÝʾ³ÌÐò°üÀ¨Èý¸öÎļþ£º
1.login.jsp:µÇÂ¼Ò³Ãæ
2.code.jsp:Éú³ÉÑéÖ¤ÂëÍ¼Æ¬Ò³Ãæ
3.check.jsp:ÑéÖ¤½á¹û
code.jsp
³ÌÐò´úÂë ==================================================
<%@ page co ......
²»´¦ÀíÌåÄÚÈݵıêÇ©Àí½âÒ»ÏÂͼƬ1
´¦ÀíÌåÄÚÈݱêÇ©Àí½âÌáͼƬ2
1£ºJspWriter out = pageContext.getOut();
2£ºBodyContent bc = this.getBodyContent();
3£ºString input = bc.getString();
4£ºJspWriter out = bc.getEnclosingWriter();
²»´¦ÀíÌåÄÚÈÝ
µÚÒ»ÐдúÂëΪ²»´¦Àí±êÇ©ÌåÄÚÈÝʱÄõ½ÐèÒªµÄÊä³öµ½Ò³ ......
Äãʱ³£±»¿Í»§±§Ô¹JSPÒ³ÃæÏìÓ¦ËٶȺÜÂýÂð£¿ÄãÏë¹ýµ±¿Í»§·ÃÎÊ´ÎÊý¾çÔöʱ£¬ÄãµÄWEBÓ¦ÓÃÄܳÐÊÜÈÕÒæÔö¼ÓµÄ·ÃÎÊÁ¿Âð£¿
±¾ÎĽ²ÊöÁ˵÷ÕûJSPºÍservletµÄһЩ·Ç³£ÊµÓõķ½·¨£¬Ëü¿ÉʹÄãµÄservletºÍJSPÒ³ÃæÏìÓ¦¸ü¿ì£¬À©Õ¹ÐÔ¸üÇ¿¡£¶øÇÒÔÚÓû§ÊýÔö¼ÓµÄÇé¿öÏ£¬ÏµÍ³¸ºÔØ»á³ÊÏÖ³öƽ»¬Éϳ¤µÄÇ÷ÊÆ¡£ÔÚ±¾ÎÄÖ ......
·½·¨Ò»¡¢
login.html
<html>
<head>
<title>Óû§µÇ¼</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<script language="javascript">
&nbs ......