日期:2014-05-18  浏览次数:20660 次

急!浏览器传中文.在线等
各位大侠;
    小弟做了一网站,平台是采用jdk1.6+tomcat6.0+mysql5.0   在采用浏览器传中文时一切正常,但是在tomcat5.5或resin3.1就出现乱码了.请问这个怎么解决.

a.jsp
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   pageEncoding= "gb2312 "   errorPage= " "   %>
<%@   page     import= "java.io.* "   %>
<%@   page     import= "java.sql.* "%>
<%@   page   import= "java.lang.* "%>
<%@   page   import= "java.util.* "   %>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<link   href= "../style/style1.css "   rel= "stylesheet "   type= "text/css ">
</head>
<body>
<%
request.setCharacterEncoding( "gb2312 ");
out.println( " <script   language= 'javascript '> self.location.href= 'b.jsp?table=foodstuffs&&kinds= "+java.net.URLEncoder.encode( "礼品类 ")+ "&&menus= "+java.net.URLEncoder.encode( " <a   href= 'foodstuffs.htm '> 副食 </a> ")+ " '; </script> ");
%>
</body>
</html>


b.jsp
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   pageEncoding= "gb2312 "   errorPage= " "   %>
<%@   page     import= "java.io.* "   %>
<%@   page     import= "java.sql.* "%>
<%@   page   import= "java.lang.* "%>
<%@   page   import= "java.util.* "   %>
<%@   page   import= "java.net.* "   %>
<%@   page   import= "java.util.Vector "   %>
<%@   page   import= "java.util.Date "   %>
<jsp:useBean   id= "connbean "   scope= "page "   class= "beans.driver1 "/> //这个是一接连数据库beans
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<link   href= "../style/style1.css "   rel= "stylesheet "   type= "text/css ">
</head>
<body>
<%
request.setCharacterEncoding( "gb2312 ");
String   table=   new   String(request.getParameter( "table ").getBytes( "ISO8859_1 "));
String   kinds=   new   String(request.getParameter( "kinds ").getBytes( "ISO8859_1 "));
String   menus=   new   String(request.getParameter( "menus ").getBytes( "ISO8859_1 "));
%>