jsp页面间传中文参数示例(页面传参数编码)
来源:
中文源码网 浏览:175 次 日期:2024-05-15 22:51:06
【下载文档: jsp页面间传中文参数示例(页面传参数编码).txt 】
jsp页面间传中文参数示例(页面传参数编码)
转码:复制代码 代码如下:a.href="./showCont.jsp?tcontent="+encodeURI(encodeURI(tcontent));
解码:复制代码 代码如下:java.net.URLDecoder.decode((String)request.getParameter("tcontent"), "UTF-8");
例a.jsp源代码
复制代码 代码如下:<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
无标题文档 <% String str_test = "华工"; %>
b.jsp源代码
复制代码 代码如下:<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
无标题文档 <% String str = new String(request.getParameter("test").getBytes("ISO8859_1")); %>
<%=str %>