日期:2014-05-16 浏览次数:20651 次
话不多说,直接粘代码
发送方
UrlParaCode.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%> <html> <head> <title>My JSP 'UrlParaCode.jsp' starting page</title> </head> <body> <% String UrlPara="王屯屯"; %> <a href="UrlParaCodeAfter.jsp?UrlPara=<%=UrlPara %>">这是一个url带有中文参数</a> </body> </html>
UrlParaCodeAfter.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%> <html> <head> <title>My JSP 'ButttonUrlParaCodeAfetr.jsp' starting page</title> </head> <body> <% request.setCharacterEncoding("GBK"); response.setCharacterEncoding("GBK"); String UrlPara=request.getParameter("UrlPara"); String DecodePara = new String(UrlPara.getBytes("ISO-8859-1"), "GBK"); out.println("UrlPara"+UrlPara); out.println("DecodePara"+DecodePara); %> </body> </html>