<jsp:param>标签传递中文参数时出现乱码时,请设置request.setCharacterEncoding("具体参数")。
例如:
页面一: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 %>
<jsp:param>标签传递中文参数时出现乱码
最新推荐文章于 2024-04-20 22:18:43 发布