eclipse中JSP表单提交运行后出现乱码
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"pageEncoding="UTF-8"%></he...
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
</head>
<body>
<form action="RegisterHandle.jsp">
用户名:<input type="text" name="userName" /><br/>
密码:<input type="password" name="password" /><br/>
性别:<input type="radio" name="gender" value="male" />男
<input type="radio" name="gender" value="female" />女<br/>
住址:
<select name="address">
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="哈尔滨">哈尔滨</option>
<option value="烟台">烟台</option>
</select>
<br/>
爱好:
<input type="checkbox" name="favor" value="游戏" />游戏
<input type="checkbox" name="favor" value="英语" />英语
<input type="checkbox" name="favor" value="计算机" />计算机
<input type="checkbox" name="favor" value="跑步" />跑步
<br/>
<textarea name="memo" rows="6" cols="50">请留言...</textarea>
<hr/>
<input type="submit" value="注册" />
<input type="reset" value="重置" />
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
%>
<%
String userName=request.getParameter("userName");
String password=request.getParameter("password");
String gender=request.getParameter("gender");
String address=request.getParameter("address");
String[] favor=request.getParameterValues("favor");
String memo=request.getParameter("memo");
out.println("用户名:" + userName + "<br/>");
out.println("密码:" + password + "<br/>");
out.println("性别:" + gender + "<br/>");
out.println("爱好:");
for(String f : favor){
out.println(f+" ");
}
out.println("<br/>");
out.println("留言:" + memo+ "<br/>");
%> 展开
pageEncoding="UTF-8"%>
</head>
<body>
<form action="RegisterHandle.jsp">
用户名:<input type="text" name="userName" /><br/>
密码:<input type="password" name="password" /><br/>
性别:<input type="radio" name="gender" value="male" />男
<input type="radio" name="gender" value="female" />女<br/>
住址:
<select name="address">
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="哈尔滨">哈尔滨</option>
<option value="烟台">烟台</option>
</select>
<br/>
爱好:
<input type="checkbox" name="favor" value="游戏" />游戏
<input type="checkbox" name="favor" value="英语" />英语
<input type="checkbox" name="favor" value="计算机" />计算机
<input type="checkbox" name="favor" value="跑步" />跑步
<br/>
<textarea name="memo" rows="6" cols="50">请留言...</textarea>
<hr/>
<input type="submit" value="注册" />
<input type="reset" value="重置" />
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
%>
<%
String userName=request.getParameter("userName");
String password=request.getParameter("password");
String gender=request.getParameter("gender");
String address=request.getParameter("address");
String[] favor=request.getParameterValues("favor");
String memo=request.getParameter("memo");
out.println("用户名:" + userName + "<br/>");
out.println("密码:" + password + "<br/>");
out.println("性别:" + gender + "<br/>");
out.println("爱好:");
for(String f : favor){
out.println(f+" ");
}
out.println("<br/>");
out.println("留言:" + memo+ "<br/>");
%> 展开
2个回答
2016-12-09 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询