If the page in jsp: include is garbled, you must add the <body>
<%
Request. setCharacterEncoding ('utf-8 "); // or the specified encoding (GBK or other)
%>
As shown below:
Copy codeThe Code is as follows:
Jsp-include.jsp
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" %>
<Html>
<Head> <title> jsp include test page </title> <Body>
<%
Request. setCharacterEncoding ("UTF-8 ");
%>
<H3> jsp include command test
<Jsp: include page = "forward-result.jsp">
<Jsp: param name = "age" value = "32"/>
<Jsp: param name = "username" value = "Zhang San"/>
</Jsp: include>
</Body>
</Html>
Forward-result.jsp
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" %>
<Html>
<Head> <title> forward result page </title> <Body>
Age: <% = request. getParameter ("age") %> <br/>
Name: <% = request. getParameter ("username") + "-- 11" %>
</Body>
</Html>