http://expert.csdn.net/Expert/topic/1020/1020873.xml?temp=.1090052
解决方案 »
- tomcat启动出现Caused by: java.lang.StringIndexOutOfBoundsException: String index out
- 各位大侠们,帮我们OK一下两个问题,只要进来分数都是100分
- 在一个jsp中传递很多参数到另外一个jsp怎么做比较好
- jsp配制的的问题.http://localhost:8080 打不开.
- 在.war里,jsp无法访问servlet;急急急急急急急急
- 谁有动态生成rss文件代码? 急急
- 关于Applet的缓存问题
- 左侧DeepTree块的实现代码,急~~~,可用就给分!
- deploy myeclipse j2ee project to server
- 一个Servlet从jsp中获取到值后,转发到另一个Servlet中显示出来
- 在显示double型数据时,如何不用科学计数法?
- 在线等待:怎么不能对数据库操作呀??
String yourString ="显示的中文";
out.println(new String(yourString.getBytes("ISO8859_1"),"GBK"));一般都可以搞定,就是太麻烦了一些,每次都要进行转换,不知有没有简单一些的方法。
try{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp.trim();
}catch(Exception e)
{
return "null";
}}
用它来转换一下就可以了!
<%@ page contentType="text/html; charset=gb2312" %>
可以解决显示时的问题
写到数据库里时:
//试试下面的每个方法,转换得到的参数!
public static String iso8859togbk(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
return strvalue;
}
}catch(Exception e){
return null;
}
} public static String iso8859togb2312(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "gb2312");
return strvalue;
}
}catch(Exception e){
return null;
}
} public static String gb2312to8859(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gb2312"), "ISO8859_1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String gbkto8859(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gbk"), "ISO8859_1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
websphere里面:
1.把LANG='zh',
2.properties = 'GBK'
就可以啦.
weblogic里面:
1. input.propoties='GB2312'
就可以啦.tomcat如果在windows 2000中文下没问题