java: jsp:param中文亂碼
假如a.jsp/b.jsp文件中
a.jsp代碼:
需要加入:request.setCharacterEncoding("UTF-8")
<%@ 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>
b.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>
