jsp动态包含中传递中文参数出现乱码
<%@ page contentType="text/html" pageEncoding="gb2312" language="java"%>
<html>
<head><title>welcome qin</title></head>
<body>
<h1>动态包含带参数</h1>
<%
String name = "nihoa";
String info = "中国";
%>
<jsp:include page="receive.jsp" flush="true">
<jsp:param name="name" value="<%=name%>"/>
<jsp:param name="info" value="<%=info%>"/>
</jsp:include>
</body>
</html>
被包含的文件receive.jsp
<%@ page contentType="text/html" pageEncoding="GBK" language="java" %>
<h2><font color="blue">传递过来的参数1:<%=request.getParameter("name")%></font></h2>
<h2><font color="green">传递过来的参数2:<%=request.getParameter("info")%></font></h2>
[解决办法]
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
[解决办法]
把编码都统一了,别一时GBK一时gb2312
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
这些在接收数据时也加上