此种情况是在进行条件查询分页的时候,某个条件的值是汉字,点查询(第一次)为POST方式提交,不会出现乱码
当点下一页(第一次之后)为get提交,这时后台会出现中文乱码的问题,解决方案:
jsp:
<form name="queryform" id="queryform" action="${path}/information_admlist.action" method="post">
<input type="hidden" name="method" value="post">
标题:<input style="vertical-align:middle;" type="text" name="title">
<input style="vertical-align:middle;" type="submit" value="查询">
</form>
<!--这里省略了首页等-->
<a href="${path}/xxx.action?page=${pm.currentPage+1}&title=${title}">下一页</a>
Action:
StringBuffer condition = new StringBuffer("");
String method = request.getParameter("method");
String title = request.getParameter("title");
//提交方式post
if(null != method && !"".equals(method) && method.equals("post")){
if(null != title && !"".equals(title)){
condition.append(" and im.title like '%").append(title).append("%'");
//编码
title = URLEncoder.encode(title, "UTF-8");
}
}else{//get
if(null != title && !"".equals(title)){
title = new String(title.getBytes("ISO-8859-1"),"UTF-8");
condition.append(" and im.title like '%").append(title).append("%'");
//编码
title = URLEncoder.encode(title, "UTF-8");
}
}
分享到:
相关推荐
PHP接收GET中文参数乱码深入研究.
tomcat get提交中文乱码解决方案,修改tomcat server.xml 中以下为
下面小编就为大家带来一篇页面get请求 中文参数方法乱码问题的快速解决方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
C++Http上传文件到web服务器,解决中文参数乱码问题,微软提供的Chttpconnect 类在请求http头参数是中文时出现乱码
JAVA过滤器filter request.setCharacterEncoding仅对POST提交起作用,对GET提交还是会出现乱码问题
get方式传参中文乱码问题的解决方案
JSP-GET-POST传递的乱码问题 中文参数传递乱码问题一直伴随着我们,整理的解决过程。
SpringMVC解决GET请求时中文乱码的问题.rar
get提交中文乱码 地址重写中文乱码 jsp url中文乱码四种解决方式
修改Tomcat默认编码消除get方式传递参数出现中文乱码修改Tomcat默认编码消除get方式传递参数出现中文乱码修改Tomcat默认编码消除get方式传递参数出现中文乱码修改Tomcat默认编码消除get方式传递参数出现中文乱码
主要介绍了PHP采用get获取url汉字出现乱码的解决方法,是很多PHP程序员都曾遇到的问题,非常具有实用价值,需要的朋友可以参考下
https://blog.csdn.net/myWorld001/article/details/109261850
在页面中对URL进行编码,最好不要在URL中传递中文参数否则会出现乱码
java解决解决get中文乱码问题,在项目中多次使用,从未有错!
get请求乱码问题 java
本资源我重新整理,用unicode完美解决中文乱码问题。用法: 1.声明实例 IniFile iniFile = new IniFile(HttpContext.Current.Server.MapPath("~/App_Data/LocalData.ini")); 2.存数据 iniFile.WriteValue...
get post提交表单中文乱码过滤器(java)
URL参数拼接, URL参数拼接, URL参数拼接, URL参数拼接, URL参数拼接
IE 浏览器在get请求下中文乱码的问题