JSP 传递中文参数的例子

复制代码 代码如下:
<?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>

jsp技术JSP 传递中文参数的例子,转载需保留来源!

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。