【求助】JSP+MySQL 中文编码问题
在MySQL中用sql语句插入就可以正常插中文,在JSP中也可以显示中文,可是在JSP往MySQL里插数据的时候数据库中显示的就是???,我甚至尝试重新安装过MySQL,安装的时候选择的也是gb2312,数据库和表我也设置的是gb2312。我看了很多这方面的帖子,问题依然没有得到解决,请求CSDN的朋友帮助,谢谢大家。代码如下:
<%@page contentType= "text/html; charset=gb2312 " language= "java "%>
<%@page pageEncoding= "gb2312 "%>
<%@page import= "java.sql.* "%>
<html>
<jsp:useBean id= "dbm " scope= "session " class= "web.dbm "/>
<jsp:setProperty name= "dbm " property= "* "/>
<jsp:useBean id= "sqlm " scope= "session " class= "web.sqlm "/>
<jsp:setProperty name= "sqlm " property= "* "/>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<head>
<title> 提交成功 </title>
</head>
<body bgcolor= "#ffffff ">
<%!String gsmc;%>
<%!String lxr;%>
<%!String lxdh;%>
<%!String lxcz;%>
<%!String email;%>
<%!String lybt;%>
<%!String lynr;%>
<%
gsmc = new String(request.getParameter( "gsmc ").getBytes( "ISO-8859-1 "));
// String temp_p=request.getParameter( "gsmc ");
// byte[] temp_t=temp_p.getBytes( "ISO-8859-1 ");
// String temp=new String(temp_t);
lxr = new String(request.getParameter( "lxr ").getBytes( "ISO-8859-1 "));
lxdh = new String(request.getParameter( "lxdh ").getBytes( "ISO-8859-1 "));
lxcz = new String(request.getParameter( "lxcz ").getBytes( "ISO-8859-1 "));
email = new String(request.getParameter( "email ").getBytes( "ISO-8859-1 "));
lybt = new String(request.getParameter( "lybt ").getBytes( "ISO-8859-1 "));
lynr = new String(request.getParameter( "lynr ").getBytes( "ISO-8859-1 "));
try {
dbm.getConnection();
out.print(gsmc);
out.print(lxr);
out.print(lxdh);
out.print(lxcz);
out.print(email);
out.print(lybt);
out.print(lynr);
sqlm.setSqlStr( "insert into pic values( '我 ') ");
sqlm.executeUpdate();
sqlm.setSqlStr( "insert into liuyan values( ' " + gsmc + " ' " + ", ' " + lxr + " ', ' " + lxdh + " ', ' " + l