be based on jsp:included The use and application of jsp:param Solutions to garbled code

Time:2021-2-21

If jsp:include If the page in is garbled, you need to use the< jsp:include page= After < body > in the “>” page
<%
    request.setCharacterEncoding (‘utf-8 ‘); / / or 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
 <body>
 <%
  request.setCharacterEncoding(“UTF-8”) ;
 %>
< H3 > JSP include instruction test</h3>

 <jsp:include page=”forward-result.jsp”>
  <jsp:param name=”age” value=”32″ />
  < jsp:param name= “User name” value = Zhang San / >
 </jsp:include>

 </body>
</html>
forward-result.jsp
<%@ page language=”java” contentType=”text/html;charset=UTF-8″ %>
<html>
The result page of < head > < title > forward < / Title > < / head >
 <body>
Age: <%= request.getParameter (“age”)%><br />
Name: <%= request.getParameter (“username”) +”–11″%>

 </body>
</html>

Recommended Today

Large scale distributed storage system: Principle Analysis and architecture practice.pdf

Focus on “Java back end technology stack” Reply to “interview” for full interview information Distributed storage system, which stores data in multiple independent devices. Traditional network storage system uses centralized storage server to store all data. Storage server becomes the bottleneck of system performance and the focus of reliability and security, which can not meet […]