在mediright.jsp页面中有个form:<form action="mediright.jsp" method="post">
编码:<input type="text" name="code" id="code" >
</form>在此页面中这样活动code的值
<%
String code = request.getParameter("code");
System.out.println(code);
%>打印出来code的值是乱码,用method="get"也是乱码
如果把method="post" 去掉 了就不是乱码了
这是为什么啊,我想用post但不会出现乱码,怎么弄啊?我用的是GBK
<%@ page contentType="text/html; charset=GBK" %>
过滤器用的也是GBK
编码:<input type="text" name="code" id="code" >
</form>在此页面中这样活动code的值
<%
String code = request.getParameter("code");
System.out.println(code);
%>打印出来code的值是乱码,用method="get"也是乱码
如果把method="post" 去掉 了就不是乱码了
这是为什么啊,我想用post但不会出现乱码,怎么弄啊?我用的是GBK
<%@ page contentType="text/html; charset=GBK" %>
过滤器用的也是GBK
改成GBK
request.setCharacterEncoding("GBK")
request.getParameter("code").getBytes("iso8859-1"),"GBK"