首页 > 代码库 > 用<jsp:include>或<jsp:forward>动作标签与<jsp:param>搭配使用时出现的乱码问题

用<jsp:include>或<jsp:forward>动作标签与<jsp:param>搭配使用时出现的乱码问题

解决方案:在原请求也加入request.setCharacterEncoding("gb2312");

例子1:

<%

request.setCharacterEncoding("gb2312");

%>

<jsp:include page="content.jsp">

<jsp:param name="param" value="http://www.mamicode.com/哈哈哈"></jsp:param>

</jsp:include>

例子2:

<%

request.setCharacterEncoding("gb2312");

%>

<jsp:forward page="content.jsp">

<jsp:param name="param" value="http://www.mamicode.com/哈哈哈"></jsp:param>

</jsp:forward>


用<jsp:include>或<jsp:forward>动作标签与<jsp:param>搭配使用时出现的乱码问题