中文编码问题,转换一下就行了。
给你个函数
public String getStr(String str){
try{
String temp_p=str;
byte [] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}
catch(Exception e){
e.printStackTrace();
return "null";
}
}

解决方案 »

  1.   

    return str=new String(str.getBytes("ISO8859-1"));
      

  2.   

    多谢两位。这个转码我知道,有没有其它办法如通过设置某个属性值,而不用在每一个getParamter中调用转码方法啊?
      

  3.   

    request.setCharacterEncoding("gb2312");
      

  4.   

    request.setCharacterEncoding("gb2312");
      

  5.   

    我通过request.setCharacterEncoding("gb2312")后,获取的如:
    <%=request.getParamter("userName")%>显示出来的仍是乱码啊!说明设置了request.setCharacterEncoding("gb2312")这个是无效的