当前位置: 代码迷 >> Java Web开发 >> 乱码有关问题,求指教
  详细解决方案

乱码有关问题,求指教

热度:29   发布时间:2016-04-16 22:10:12.0
乱码问题,求指教
我今天也遇到这个错,什么原因?ssh框架,在action中
public String test() throws Exception{
ServletActionContext.getResponse().setCharacterEncoding("utf-8");
ServletActionContext.getResponse().getWriter().print("美国");
return NONE;
}
public String test1() throws Exception{
ServletActionContext.getResponse().setCharacterEncoding("GBK");
ServletActionContext.getResponse().getWriter().print("中国");
return NONE;
}
其他配置文件都是utf8,上面测试utf8美国乱码,gbk中国没有乱码
------解决方案--------------------
肯定还有哪一环编码没统一!server.xml是否改了!
  相关解决方案