Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 求助~JSP乱码再现~~~~~~~大虾帮手~~
naughty009





发贴: 56
于 2005-08-23 21:13 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
demo.jsp代码如下:

<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage=""%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>建立session</title>
<body>
<%
request.getSession(true);
session.putValue("enter","true");
%>
<center><font color=green size=5><b>你好,欢迎你来到naughty世界</b></font>
<a href=demo1.jsp>浏览最新信息</a>
<font color=red size=4>
<%
  request.setCharacterEncoding("GBK");
  String msg=request.getParameter("msg");
  if(msg!=null)
  out.print("<br>" + msg);
%>
</center>
</body>
</html>

demo1.jsp代码如下:

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站内页</title>
</head>

<body>
<%
  
  if((String)session.getValue("enter")!="true");
  response.sendRedirect("demo.jsp?msg=你好啊~");
%>
</body>
</html>

当运行时,“你好啊~”就变成了乱码了,英文就不会,中文就出问题了~




话题树型展开
人气 标题 作者 字数 发贴时间
3843 求助~JSP乱码再现~~~~~~~大虾帮手~~ naughty009 1130 2005-08-23 21:13
2748 Re:求助~JSP乱码再现~~~~~~~大虾帮手~~ benbon 286 2005-09-09 10:15

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923