相思资源网 Design By www.200059.com

test1.jsp页面:

复制代码 代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'test1.jsp' starting page</title>
  </head>
  <body>
    <a href="test2.jsp?name=<%=java.net.URLEncoder.encode("王云鹏","utf-8") %>">test2.jsp</a>
  </body>
</html>


test2.jsp页面:

复制代码 代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String name = request.getParameter("name");//get tomcat 's string formatter is ISO-8859-1
    byte[] names = java.net.URLEncoder.encode(name,"ISO-8859-1").getBytes();//get inner tomcat 's byte content
    name = new String(names,"utf-8");//get url 's string formatter is utf-8
    name = java.net.URLDecoder.decode(name,"utf-8");//decode string to chinese word
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <title>My JSP 'test2.jsp' starting page</title>

  </head>

  <body>
    Name:<%=name %>
  </body>
</html>

标签:
jsp,传参,中文乱码

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“jsp地址栏传中文显示乱码解决方法分享”

暂无jsp地址栏传中文显示乱码解决方法分享的评论...