晕,打错几个字。上面是请教高手解决这个问题。。看了一晚上的jsp,头晕了,打错了。

解决方案 »

  1.   

    String sqlstmt = new String(sql.getBytes(),"8859_1");

    String sqlstmt = new String(sql.getBytes("GB2312"),"8859_1");
      

  2.   

    我做过一个查询,关键字(key)可以是汉字,我只是在取得关键字时这样取得:
    String key=new String(request.getParameter("gjz").getBytes("8859_1"));//关键字可以是汉语
    然后下面就可以查询数据库了,我用的时oracle:
    if(id.equals("all"))
               sql="select title,id from tbltitlecount where content like"+"'%"+key+"%'";
          else
               sql="select title,id from tbltitlecount where content like"+"'%"+key+"%' and classid="+id;
    没问题的,可以查询条件是汉字的,你试试,希望对你有帮助。
      

  3.   

    非常感谢,我用ufotree的方法实现了!