jsp乱码

来源:互联网 发布:jsp和java 编辑:程序博客网 时间:2024/05/19 20:44

FieldSet.html

<html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<body>
<form name=form1 action="FormData.jsp" method="post">
<fieldset>
<input type=checkbox name=box1 checked OnClick="document.form1.text1.value='box1';">box1为默认值<br>
<input type=checkbox name=box2 OnClick="document.form1.text1.value='box2';">box2<br>
<input type=checkbox name=box3 disable>box3并无确认功能<br>
<input type=text name=text1 value=""><br>
</fieldset>
<input type=submit name=submit value="确实">
</form>
</body>
</html>

FormData.jsp

<html>
<%@ page contentType="text/html; charset=gb2312" %>
<body>
<%java.util.Enumeration e=request.getParameterNames();%>
<table border="1">
<tr><th>name</th><th>value</th></tr>
<%while(e.hasMoreElements())
 {
 String name=(String) e.nextElement();
 String aa=new String(request.getParameter(name).getBytes("ISO8859_1"),"GBK"); 
 out.println("<tr><td>"+name+"</td>"); 
 out.println("<td>"+aa+"</td></tr>");
 }
%>
</table>
</body>
</html> 

原创粉丝点击