日期:2014-05-16  浏览次数:20389 次

JSP处理乱码问题
<form action=b.jsp method=get >
	<input name=user value=我们>
	<input type=submit value=get>
</form>

<form action=b.jsp method=post >
	<input name=user value=他们>
	<input type=submit value=post>
</form>

<a href="http://127.0.0.1/my/b.jsp?user=你们">this is a link</a>


<form action=b.jsp method=get >
	<input name=user value=我们>
	<input type=submit value=get>
</form>

<form action=b.jsp method=post >
	<input name=user value=他们>
	<input type=submit value=post>
</form>

<a href="http://127.0.0.1/my/b.jsp?user=你们">this is a link</a>


<jsp:forward page="b.jsp">
	<jsp:param name="user" value="它们" />
</jsp:forward>



<%
	response.sendRedirect("b.jsp?user=她们");
%>


<%@ page contentType="text/html;charset=gb2312"%>
<jsp:include page="b.jsp?user=哈哈哈哈哈哈哈哈" />



<%@ page contentType="text/html;charset=GBK"%>

<%//@ page pageEncoding="iso8859-1"%>

<%request.setCharacterEncoding("GBK");%>

<%String s = "嘿嘿";%>

<%//s = new String ("嘿嘿".getBytes(),"iso8859-1");%>

<jsp:include page="b.jsp">
	<jsp:param name="user" value="<%=s%>"/>
</jsp:include>




<%@ page contentType="text/html;charset=GBK"%>

<%request.setCharacterEncoding("GBK");%>
<%=request.getParameter("user") %>

<%String s = "哈哈哈";%>
<%=s%>