应该是
com = new String(com.getBytes("GB2312"),"iso-8859-1");数据库里要在iso-8859-1形式的,表示在网页里才是com = new String(com.getBytes("iso-8859-1"),"GB2312");

解决方案 »

  1.   

    你用的JDBC驱动是哪个版本的?有的能自动转换
    你用的操作系统是什么呀?windows or linux
      

  2.   

    你试试
    <%@ page language="java" contentType="text/html;charset=GBK"%> request.setCharacterEncoding("GB2312");String   com = request.getParameter("n2");
       com = new String(com.getBytes(),"GB2312");
    <body>
    <%
      request.setCharscterEncoding("GBK");
    %>
    </body>
      

  3.   

    request.setCharacterEncoding("GB2312");String   com = request.getParameter("n2");这个时候的com根本不应该再做任何的转换,因为已经是中文了(你可以输出到JSP中确认)mysql的中文问题是你需要在C:\winnt\my.ini中加入
    default-character-set=gbk
    并且在连接字符串中加入 ?useUnicode=true&characterEncoding=GBK