request.getCharacterEncoding("UTF-8");
不知是不是问这个
不知是不是问这个
解决方案 »
- 菜鸟求助:manager cannot be resolved
- tomcat部署出错 求救
- jsp中response.getWriter().println输出div中的属性怎么拼接?
- 关于glassfish
- 关于lucene的问题,为何没人回……,人呢………………
- 无法解析Class类?帮帮忙啊!
- 怎么用JBuilderX建一个jsp
- 关于jquery ajax问题
- [Good News]IBM WebSphere Studio Application Developer 5.1推出啦!!!
- 要做一个vod视频点播,没有一点头绪,谁能给点建议?急
- applet滚动条问题
- servlet如何可以把传进来的form表单参数再回传给调用他的jsp文件?
先写 request.setCharacterEncoding("UTF-8");页面最好也是以utf-8编码显示
if(str==""){
str ="null" ;
}
else{
try {
str = new String(str.getBytes("GB2312"),"UTF-8");
}
catch (Exception ex) {
System.out.print(ex);
}
}
return str ;
}
试试
2.String trans(String 参数)
{
String result = null;
byte temp [];
try
{
temp=参数.getBytes("编码");
result = new String(temp);
}
catch(UnsupportedEncodingException e)
{
System.out.println (e.toString());
}
return result;
trans(request.getParameter("参数"))