这样传汉字一般都会成乱码,如果你用的Web服务器是Tomcat我倒是有解决办法。
解决方案 »
- 到底要多大,你才满意?
- struts-config中的plug-in里面的value
- 高手帮忙--为什么使用ResultSet的last()方法和absolute()方法总是报错呢?
- web.xml文件为何在weblogic启动时会重新生成,从而覆盖现有的
- 请发给我一个JBoss下开发的实体Bean 的例子
- 最最笨的struts问题,真的不好意思问,但我在网上找了好几天,在CSDN也搜遍了,还是没解决,求大家帮我。
- 有没有可以根据数据库结构生成ActionForm或使用了struts tags的jsp文件的工具?
- 祝大家圣诞快乐!
- 请提供基本介绍j2ee入门的书??
- Ajax请求数据库,Struts2返回不到指定的页面
- 怎样配置,让b/s架构的java项目双击就可运行?请教各位前辈!
- 100高分:求一个很好的将mysql数据库转换成oracle的工具
把他改成GB2312就可以了String name=request.getParameter("name");
name=new String(name.getBytes("GB2312"));
System.out.println(name);
name=new String(name.getBytes("ISO-8859-1"),"GB2312");
System.out.println(name);
public class SetCharacterEncodingFilter implements Filter { protected String encoding = null;
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException { String encoding = selectEncoding(request);
if (encoding != null)
request.setCharacterEncoding(gb2312);
} // Pass control on to the next filter
chain.doFilter(request, response); }
public void destroy() { this.encoding = null;
}}
转码过滤器源代码如下:
public class SetCharacterEncodingFilter implements Filter { protected String encoding = null;
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException { String encoding = selectEncoding(request);
if (encoding != null)
request.setCharacterEncoding(gb2312);
} // Pass control on to the next filter
chain.doFilter(request, response); }
public void destroy() { this.encoding = null;
} }