sendRedirect里的乱码问题如何处理?

bjzhanghao 2003-04-07 12:15:46
文件info.jsp内容如下:
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<body>
<%=request.getParameter("info")%>
</body>
</html>

在另一个页面使用
response.sendRedirect("info.jsp?info=错误的id号!");

发现页面显示的是乱码,url里也是乱码。应该如何解决呢?
...全文
83 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
dybine 2003-04-07
  • 打赏
  • 举报
回复
String msg = "错误的id号!";
msg = new String(msg.getBytes("GBK"), "iso-8859-1");
response.sendRedirect("info.jsp?info="+msg);
bjzhanghao 2003-04-07
  • 打赏
  • 举报
回复
两个页面都有<%@ page contentType="text/html; charset=gb2312" %>
或者在jsp里如何达到像servlet里return那样的效果?
mayuanfei 2003-04-07
  • 打赏
  • 举报
回复
看看你response.sendRedirect("info.jsp?info=错误的id号!");的页面里有没有
<%@ page contentType="text/html; charset=gb2312" %>
如果你是在ServerLet中进行转页的话情况就不同了.
flashroom 2003-04-07
  • 打赏
  • 举报
回复
enCode 掉中文

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧