1. Static embedding of sub-pages
<% @include file="header.jsp" %>
static embedding support jsp
, html
and xml
plain text.
Static embedding is done at compile time, which is equivalent to inserting the text of a child page directly into include
the location of the label. A child page can use variables directly from the parent page.
2. Dynamic embedding of sub-pages
You jsp:include
must set the property to when you use it flush
true
.
<jsp:include page= "/main/header.jsp" flush= "true"/>
Otherwise, the child page will be reported 500 error when nesting
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "
pageencoding= "UTF-8"%>
<jsp:include page= "/main/header.jsp" flush= "true"/>
<div class= "Right" >
<div class= "Wfont" >
<p> Welcome to the supermarket billing management system!</p>
</div>
</div>
<jsp:include page= "/main/footer.jsp" flush= "true"/>
SPRINGMVC two ways to embed a page using Jsp:include