标签传递中文参数时出现乱码

<jsp:param>标签传递中文参数时出现乱码时,请设置request.setCharacterEncoding("具体参数")。
如若还不行,设置server.xml中设置<Connector>元素的useBodyEncodingForURI属性为true。(此步没经过测试)
例如:
页面一:jspparam.jsp

<%@ page pageEncoding="GB2312"%>
<%request.setCharacterEncoding("GB2312"); %>
<jsp:forward page="getparam.jsp?country1=中国">
  <jsp:param name="country2" value="中国"/>
</jsp:forward>

页面二:getparam.jsp
<%@ page pageEncoding="gb2312" c%>
<%
String country1 = request.getParameter("country1");
String country2 = request.getParameter("country2");

%>
country1 = <%=country1 %>
country2 = <%=country2 %>

你可能感兴趣的:(C++,c,jsp,xml,C#)