三種解決方式如下
1、可以覆蓋父類ActionServelt 的process 方法(針對(duì)服務(wù)器)
在其中加入如下代碼:
request.setCharacterEncoding ("GB2312");//字符集內(nèi)碼轉(zhuǎn)換
super.process (request, response);//ActionServlet 的處理
2、針對(duì)Validate方法
native2ascii -encoding GBK ApplicationResources_xx.properties ApplicationResources_zh.properties
3、提交的中文字符在服務(wù)器端(JBOSS)亂碼
解決辦法:增加一個(gè)filter,里面將request中的中文轉(zhuǎn)換為GBK
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("GBK");
chain.doFilter(request,response);
}
1、可以覆蓋父類ActionServelt 的process 方法(針對(duì)服務(wù)器)
在其中加入如下代碼:
request.setCharacterEncoding ("GB2312");//字符集內(nèi)碼轉(zhuǎn)換
super.process (request, response);//ActionServlet 的處理
2、針對(duì)Validate方法
native2ascii -encoding GBK ApplicationResources_xx.properties ApplicationResources_zh.properties
3、提交的中文字符在服務(wù)器端(JBOSS)亂碼
解決辦法:增加一個(gè)filter,里面將request中的中文轉(zhuǎn)換為GBK
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("GBK");
chain.doFilter(request,response);
}