处理jsp的容器如tocmat 使用默认的编码方式是UNICODE jdk也是  jdbc支持中文的啊 看错误好象是jdbc没有识别你的数据库的编码方式 换个数据库试试

解决方案 »

  1.   

    对了是要进行编码转换才可以的,这个问题是中文问题下面我找到一些中文问题供你参考:
    如果你的记录来自数据库表rs
     System.out.println(new String(rs.getString("loginname").getBytes("gb2312") )) ;
     System.out.println(new String(rs.getString("loginname").getBytes("8859_1"))  ) ;<%@ page contentType="application/msword;charset=gb2312" %>
    加上上面一句,JSP在IE中变得可以编辑的了,唉
    解决乱码问题最好用
    <%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK" %>字符编码转换常用的方法是
      String native_encoded = "中文字符串"; 
                //本地编码的字符串
      Byte[] byte_array = native_encoded.getBytes(); 
                //得到本地编码的字节数组
      String net_encoded = new String(native_encoded, "ISO-8859-1"); 
                //生成ISO-8859-1编码的字符串//FormDemo.java
      import java.io.*;
      import javax.servlet.*;
      import javax.servlet.http.*;
      public class FormDemo extends HttpServlet {
       public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException //处理GET请求的方法
       {
        response.setContentType("text/html"); 
        //先设置Header,在这里只设置ContentType一项
        PrintWriter out = response.getWriter(); 
        //得到文本输出Writer    String name = request.getParameter("Name"); 
        //得到表单值Name
        String sex = request.getParameter("Sex"); 
        //得到表单值Sex
        name = new String(name.getBytes(),"ISO-8859-1"); 
        //转换到正确的编码    //打印得到的表单值
        out.println("<html>");
        out.println("<head>");
        out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">");
        out.println("<title>Your Info</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h3>Data You Posted</h3>");
        out.println("<table>");
        out.println("<tr>");
        out.println(new String(new String("<td>你的姓名:</td>").getBytes(),"ISO-8859-1"));
        out.println("<td>"+name+"</td>");
        out.println("</tr>");
        out.println("<tr>");
        out.println(new String(new String("<td>你的性别:</td>").getBytes(),"ISO-8859-1"));
        out.print("<td>");
        if(sex.equals("1")) out.println(new String(new String("男</td>").getBytes(),"ISO-8859-1"));
        else out.println(new String(new String("女</td>").getBytes(),"ISO-8859-1"));
        out.println("</tr>");
        out.println("</table>");
        out.println("</body>");
        out.println("</html>");
        out.close(); //关闭Writer
       }
      }