通过本文主要向大家介绍了jsp页面汉字乱码,jsp页面汉字显示乱码,jsp汉字乱码,jsp汉字编码,jsp页面获取url参数等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
转码:a.href="./showCont.jsp?tcontent="+encodeURI(encodeURI(tcontent));
解码:java.net.URLDecoder.decode((String)request.getParameter("tcontent"), "UTF-8");
例
a.jsp源代码
<body>
<%
String str_test = "华工";
%>
<form method=post action="b.jsp?test=<%=java.net.URLEncoder.encode(str_test) %>">
<input type="submit" value="Submit" name="提交">
</form>
</body>
</html>
</div>
b.jsp源代码
<body>
<%
String str = new String(request.getParameter("test").getBytes("ISO8859_1"));
%>
<BR>
<%=str %>
</body>
</html>
</div>
</div>