您可以在这里快速查找:


 
您的位置: 编程学习 > java教程 > 200508
文章分类

Java技术
2005: 03 04 05 06 07 08
09 10 11 12
2006: 01 02

Asp.net
2005: 07 08 09 10 11 12
2006: 01 02

VB编程
2006: 02

Asp编程
2005: 11 12
2006: 01 02

C++/VC
2005: 10 11 12
2006: 01 02

Delphi
2005: 12
2006: 01 02

其它

 本文章适合所有读者

struts下的乱码问题的解决办法

pbMaster
1、页面提示信息乱码
页面的提示信息来自ApplicationResources_zh.properties
解决方法:
(1)所有jsp页面均要用
<%@ page language="java" contentType="text/html; charset=GBK" %>
指出当前页面的charset
(2)用notepad等工具(而不是Eclipse Editor)编写中文资源文件,比如ApplicationResources_xx.properties。然后用工具native2ascii将资源文件中的中文字符转换为GBK,方法是在DOS下
native2ascii -encoding GBK ApplicationResources_xx.properties ApplicationResources_zh.properties

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