随笔-124  评论-49  文章-56  trackbacks-0

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 阅读(177) 评论(0)  编辑  收藏 所属分类: jsp/servlet

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


网站导航: