request.setCharacterEncoding("gbk");
response.setCharacterEncoding("text/html;charset=gbk");
String name=request.getParameter("username");
name=new String (name.getBytes("iso-8859-1"),"gbk");
1 过滤器
HttpServletRequest req=(HttpServletRequest)request;
request.setCharacterEncoding("gbk");
china.do();
2 子控制器
public class ToChinese extends RequestProcessor{
public boolean processProcess(HttpServletRequest req,HttpServletRespone rep){
request.setCharacterEncoding("gb2312");
return true;
}
}
struts-config.xml
<controller processorClass="com.org.ToChinese"/>
posted on 2009-11-29 22:30
junly 阅读(239)
评论(0) 编辑 收藏 所属分类:
jsp/servlet