呆呆向前冲的blog

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  78 随笔 :: 43 文章 :: 5 评论 :: 74 Trackbacks
三种解决方式如下

1、可以覆盖父类ActionServelt 的process 方法(针对服务器)
在其中加入如下代码:
request.setCharacterEncoding ("GB2312");//字符集内码转换
super.process (request, response);//ActionServlet 的处理

2、针对Validate方法
   native2ascii -encoding GBK ApplicationResources_xx.properties ApplicationResources_zh.properties


3、提交的中文字符在服务器端(JBOSS)乱码
解决办法:增加一个filter,里面将request中的中文转换为GBK
public void doFilter(ServletRequest request, ServletResponse response,
  FilterChain chain) throws IOException, ServletException {
    request.setCharacterEncoding("GBK");
    chain.doFilter(request,response);
}

posted on 2005-08-10 23:06 呆呆向前冲的blog 阅读(327) 评论(0)  编辑  收藏 所属分类: 工作:Java技术

只有注册用户登录后才能发表评论。


网站导航: