当前位置: 移动技术网 > IT编程>开发语言>Java > JSP 传递中文参数的例子

JSP 传递中文参数的例子

2017年12月12日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:

<?xml version="1.0" encoding="utf-8" ?>
<!doctype html public "-//wapforum//dtd xhtml mobile 1.0//en" "http://www.wapforum.org/dtd/xhtml-mobile10.dtd">
<%@ page language="java" contenttype="text/html; charset=utf-8"
pageencoding="utf-8"%>
<%@ page import="java.net.*"%>
<%
string location = "";
string locationfromrequest = request.getparameter("location");
if (null != locationfromrequest
&& (!locationfromrequest.equals(""))) {
location = java.net.urldecoder.decode(locationfromrequest,
"utf-8");
}
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
xxxxxxxxxxxxxxxxx<%=new string(location.getbytes("iso-8859-1"),"utf-8")%>
<br/>
<a href="1234.jsp?location=<%=java.net.urlencoder.encode("望京", "utf-8")%>"> 望京</a>
</html>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网