用以下函数,如next=getCN(next);
public class getCN
{
  public String getString(String str)
{
if (str==null)
{
return "";
}
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}
catch(Exception e)
{
  return "";
}
}
}

解决方案 »

  1.   

    是不是要编码?好象jsp对中文nt支持不是很好
      

  2.   

    1.mysql后台数据的编码方式是8859,而页面的编码一般是gb,所以存入之前要进行编码,参见下面的函数。
        public static String getStr(String str){
            try{
                String temp_p=str;
                byte[] temp_t=temp_p.getBytes("ISO8859-1");
                String temp=new String(temp_t);System.out.println(temp);
                return temp;        }
            catch(Exception e){ }
                return "";
        }
    2.页面编码设置为gb,读取得时候如果是在windows平台下,可以直接读取,如果是在linux下则可能需要重新编码,我没有试验。