基于jsp:included的使用与jsp:param乱码的解决方法
2018-10-12 13:58
816 查看
如果jsp:include 中的page页面存在乱码,则需要在使用<jsp:include page=""> 的页面中的<body>后加上
<%
request.setCharacterEncoding('UTF-8") ;//或者指定的编码(GBK或其他)
%>
如下面所示:
<%
request.setCharacterEncoding('UTF-8") ;//或者指定的编码(GBK或其他)
%>
如下面所示:
jsp-include.jsp
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<html>
<head><title>jsp include测试页</title></head>
<body>
<%
request.setCharacterEncoding("UTF-8") ;
%>
<h3>jsp include 指令测试</h3>
<jsp:include page="forward-result.jsp">
<jsp:param name="age" value="32" />
<jsp:param name="username" value="张三" />
</jsp:include>
</body>
</html>
forward-result.jsp
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<html>
<head><title>forward的结果页</title></head>
<body>
年龄:<%=request.getParameter("age")%><br />
姓名:<%=request.getParameter("username") +"--11"%>
</body>
</html>
您可能感兴趣的文章:
相关文章推荐
- 基于jsp:included的使用与jsp:param乱码的解决方法
- jsp 中使用url传值的中文乱码解决方法
- 在servlet里面使用printWriter输出ireport到jsp显示乱码的解决方法
- jsp中使用ajax请求,另一个jsp接受请求插入mysql出现乱码,解决方法
- 在JSP中使用Cookie,以及操作中文的乱码解决方法
- jsp中使用传参时出现中文乱码问题的解决方法
- JSP表单提交中文乱码解决方法(使用过滤器)(GET方法无效)
- JSP,mysql,tomcat下(基于struts2)中文及其乱码问题的解决 5大配置点 使用UTF-8编码
- 今天使用jspsmartupload.jar实现上传文件的功能,发现中文乱码,于是总结了下解决方法
- jsp中使用jstl导入html乱码问题解决方法
- jsp中使用jstl导入html乱码问题解决方法
- jsp与mysql配合使用时 中文乱码 解决方法
- 使用struts2的<s:param>等标签向action传值出现中文乱码的解决方法
- jsp:include 使用jsp:param乱码解决
- jsp:include 使用jsp:param乱码解决
- JSP中文乱码问题解决方法小结
- jsp存取mysql中文数据结果为乱码的解决方法(未经验证)
- JSP中文乱码问题解决方法小结
- 解决JSP中使用request乱码问题
- JSP中文乱码问题解决方法小结