JSP怎么实现中文参数的传递

来源:爱站网时间:2022-05-20编辑:网友分享
编写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编程之标准标签库

下一篇:jsp屏蔽退格键如何操作执行

您可能感兴趣的文章

相关阅读

热门软件源码

最新软件源码下载