url传值到Action乱码的解决方法
jsp页面 URL传中文参数到Action里面出现乱码,用过滤器和控制器都解决不了,用了我两个多小时解决这个小问题!
解决方法有以下几种:
第一种:在Action中用
new String(str.getBytes("ISO8859_1"), "UTF8")
<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" useBodyEncodingForURI="true" URIEncoding="gbk">
disableUploadTimeout="true" useBodyEncodingForURI="true" URIEncoding="gbk"
<%@ page pageEncoding=”gb2312″%><%@ page contentType=”text/html;charset=gb2312″%><%request.setCharacterEncoding(”gb2312″);%>
request.setCharacterEncoding("gb2312");response.setCharacterEncoding("gb2312");