JSP中post和get乱码解决方法
来源:互联网 发布:数据统计测试用例 编辑:程序博客网 时间:2024/04/29 20:41
GET乱码解决:
tomcat下的server.xml 加入URIEncoding="GBK"
<Connector port="8089" protocol="HTTP/1.1"
maxThreads="150" connectionTimeout="20000"
redirectPort="8443" URIEncoding="GBK" />
POST乱码解决:
web.xml配置过滤器
<filter>
<filter-name>Encoding</filter-name>
<filter-class>m.Encoding</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
public class Encoding implements Filter {
protected FilterConfig filterconfig;
private String targetEncoding = "GBK";
public void init(FilterConfig config) throws ServletException {
this.filterconfig = config;
String target= config.getInitParameter("encoding");
if(target!=null){
targetEncoding = target;
}
}
public void doFilter(ServletRequest srequest, ServletResponse sresponse,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest)srequest;
request.setCharacterEncoding(targetEncoding);
chain.doFilter(srequest,sresponse);
}
public void destroy() {
this.filterconfig = null;
}
}
- JSP中post和get乱码解决方法
- get和post乱码解决方法
- java中post乱码和get乱码的解决方法
- GET和POST中文乱码的解决方法
- jsp post 乱码 解决方法
- Jsp中get和post的区别
- jsp中get和post方法的区别及产生乱码后的解决办法
- JAVA中Get、Post方式提交中文乱码解决方法
- get 和 Post 之我理解 JSP乱码
- jsp使用get和post请求中文不乱码
- jsp中文乱码问题(get和post)
- GET乱码以及POST乱码的解决方法
- JSP中文乱码问题(get,post篇)
- jsp post和get区别
- PHP中GET和POST中文传递乱码
- spring3 mvc中POST和GET乱码的解决
- 表单中get和post的中文乱码问题
- Java中Servlet的Get和Post乱码问题
- Test for Job(topo+动态规划)
- C++ 编程题练习-输出200(10-1)
- ThinkPHP find方法 查询一条数据记录
- Spring整合MyBatis错误:org.apache.ibatis.binding.BindingException
- hdu 1050
- JSP中post和get乱码解决方法
- 网页分享到微信后不能从朋友圈打开
- 调用caffe进行网络训练(caffe.cpp 解析)
- 第二次考试 (图论)第一题 劣质的草
- ttf字体包瘦身,ttf字体包提取字体——杨小辉
- Havel-Hakimi定理
- 支付系统对账算法优化方案
- build.gradle
- Spring集成CXF搭建WebService服务端与客户端