MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 急浏览器传中文

急浏览器传中文

www.MyException.Cn  网友分享于:2013-12-23  浏览:21次
急!浏览器传中文.在线等
各位大侠;
    小弟做了一网站,平台是采用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 "));
%>
</body>
</html>

请问我那里写错了,

------解决方案--------------------

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有