日期:2014-05-17 浏览次数:20820 次
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% response.setCharacterEncoding("UTF-8"); %>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<form action="BBB.jsp" method="post">
<input type="submit" name="submit" value="中文" />
</form>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% request.setCharacterEncoding("UTF-8"); %>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- 请问 #P1 为何乱码 -->
<p id="p1"><%=request.getParameter("submit")%></p>
<!-- 请问 #P2 为何要重建字符串?以前听说POST传参只需设置request编码,为什么是ISO8859_1?-->
<p id="p2"><%=new String(request.getParameter("submit").getBytes("ISO8859_1"), "UTF-8")%></p>