在插入数据库之前,把取得的数据转化String title=new String(request.getParameter("title").getBytes("ISO8859_1"));

解决方案 »

  1.   

    String title=new String(request.getParameter("title").getBytes("ISO8859_1"),"gb2312");
               ~~~~~~~~~~~~~~~
      

  2.   

    从提交的表单中取数据时,需要对代码进行转换,另外有时取数据是也需要转换,gbk或者iso8859_1
      

  3.   

    你虽然在JSP页面用了显视中文的东东,但是你那个乱码的东东是通过参数的形型传给JSP页面的。对于参数传过来的,必须要把参数通过中文转换的参数转换过来才能显视出中文来。我自己写了一个中文转换的东东,不知道对你有没有用。试试吧。
    public static String funToChinese(String strvalue) {
            try
            {
                    if(strvalue==null)
                            {
                                    return null;
                            }
                    else
                    {
                            strvalue = new String(strvalue.getBytes("ISO8859_1"),"GB2312");
                            return strvalue;
                    }
            }
                    catch(Exception e)
                    {
                            return null;
                    }
            }}
    对了,运用这人函数的时候一定要把参数转换成String型才可以的哦。祝你好运*-*
      

  4.   

    <%@ page contentType="text/html;charset=gb2312"%>