ÈçºÎÒ»¸öjspÒ³Ãæ´¦Àí¶à¸öform±íµ¥
Ê×ÏÈÊÇÌá½»Ò³Ã棺Èý¸ö±íµ¥(form1,form2,form3)
<form name="form1" method="post" action="checklogin.jsp" class="niceform">
<input name="qx" type="hidden" value="3">
<label for="textinput">ÕʺÅ:</label>
<input type="text" id="textinput" name="uid" size="12" />
<br />
<label for="passwordinput">ÃÜÂë:</label>
<input type="password" id="passwordinput" name="pwd" size="12" />
<br />
<input name="" type="submit" value="Ìá½»">
<input type="reset" name="Submit2" value="ÖØÖÃ" />
</form>
</div>
<div class=tagContent id=tagContent1>»¶ÓʹÓñ¾ÏµÍ³£¬ÇëÏÈ¡¾µÇ½¡¿»ò¡¾×¢²á¡¿¡£
<form name="form2" method="post" action="checklogin.jsp" class="niceform">
<input name="qx" type="hidden" value="2">
<label for="textinput">ÕʺÅ:</label>
<input type="text"
Ïà¹ØÎĵµ£º
JSPÒ³ÃæµÄÈýÀà»ù±¾ÔªËØ
1.ÉùÃ÷
ÐÎÈç
<%!
int a;
int add(int a,int b)
{
return a+b;
......
1.Ê×ÏÈÒª±£Ö¤jspÒ³ÃæµÄ±àÂë¸ñʽ¡¢Êý¾Ý¿â±àÂë¸ñʽ¡¢javaÎļþ±£´æ¸ñʽ¡¢·þÎñÆ÷server.xmlÖеÄURIEncoding±àÂë¸ñʽ±£³ÖÒ»ÖÂ
2 ÊÖ¶¯Ð´Ò»¸ö¹ýÂËÆ÷£¬²¢ÇÒÔÚweb.xmlÎļþÖнøÐÐÅäÖá£
¾ßÌå´úÂë²Î¿¼ÈçÏ£¨µ÷ÊÔͨ¹ý£©£º
package cn.com.model2.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.se ......
1.½ûÖ¹¿Í»§¶Ë»º´æÒªÔÚ<head>ÖмÓÈëÀàËÆÈçÏÂÄÚÈÝ£º
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2.ÔÚ·þÎñÆ÷µÄ¶¯Ì¬ÍøÒ³ÖнûÖ¹»º´æ£¬Òª¼ÓÈëÀàË ......
ÑéÖ¤ÂëµÄÉú³É˼ÏëÊÇÔÚ·þÎñÆ÷¶ÎÔ¤ÏÈÉú³ÉºÃÑéÖ¤Â룬ǰ̨ÏÔʾ£¬È»ºóÔÙµ½ºǫ́ȥƥÅ䣡
code.jsp:
<%@ page language="java" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*"
contentType="image/jpeg" pageEncoding="UTF-8"%>
<% //ÉèÖÃÒ³Ãæ²»» ......
1¡¢jspÒ³ÃæÂÒÂ룺
ÔÚjspÒ³Ã濪ʼÌí¼Ó<%pageEncoding="uft-8"%>
2¡¢servletÊä³öÂÒÂ룺
ÔÚÊä³öÄÚÈÝ֮ǰ£¬ÏÈÖ´ÐÐresponse.setContentType
("text/html;charset=utf-8")
3¡¢ÔÚformÀïÓÃpost·½Ê½Ìá½»²ÎÊý£º
1£©½ÓÊÕʱ¼Órequest.setCharacterEncoding("utf-8")
2£©Ê¹ÓùýÂËÆ÷£¬ÔÚ½ÓÊÕ²ÎÊý֮ǰ£¬É趨´«µÝµÄ²ÎÊýÄ ......