先对js中的中文进行编码。。。
然后到action去解码就可以了。。。
具体实现。。。
js编码
var comment = document.all.comment.value;
comment = encodeURI(comment );
comment = encodeURI(comment );//注意要两次
action解码
String comment = request.getParameter("comment ");
try {
comment = java.net.URLDecoder.decode(comment, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
jsp Action中文乱码解决
精选 转载michael_zhou 博主文章分类:J2EE Web开发
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
JS中理解码点和码元,解决emoji带来的乱码问题
了解码元和码点,处理emoji表情字符串截取带来的乱码问题,在String原型中增加自定义方法来处理
码元 码点 emoji乱码 字符串截取 字符串长度 -
JSP解决向Action传参乱码问题
1:可以写一个字符过滤器来解决 package com.capinfotech.filter;import javax.servlet.*;
action jsp encoding string import -
Servlet及JSP解决中文乱码问题
Servlet及JSP解决中文乱码问题  
职场 乱码 休闲 Servlet及JSP解决中文乱码问题 -
jsp 提交表单到 action 中文乱码(GETPOST)
UTF-8 和 GBK 就像魔咒一样长久地困扰着程序设计人员! ...
Java struts ide 用户名 tomcat