Directory structure
Header.jspf
<%@ Page pageencoding="Utf-8" %><HTML><Head></Head><Body><H1style= "background: #999; color: #fff;p adding:10px;">Hello website.</H1>
Admin_header.jspf
<%@ Page pageencoding="Utf-8" %><HTML><Head></Head><Body><H1style= "background: #999; color: #fff;p adding:10px;">Hello Admin Information Management system.</H1>
Footer.jspf
<%@ Page Import="Java.util.Calendar"pageencoding="Utf-8" %><H1style= "background: #999; color: #fff;p adding:10px;">©2000-<%=calendar.getinstance (). Get (Calendar.year)%>Beast-king Corp.</H1>
Xml
<?XML version= "1.0" encoding= "UTF-8"?><Web-appversion= "3.0"xmlns= "Http://java.sun.com/xml/ns/javaee"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <welcome-file-list> <Welcome-file>index.jsp</Welcome-file> </welcome-file-list> <Jsp-config> <Jsp-property-group> <Url-pattern>/main/*</Url-pattern> <page-encoding>UTF-8</page-encoding> <Default-content-type>Text/html</Default-content-type> <Include-prelude>/jspf/header.jspf</Include-prelude> <Include-coda>/jspf/footer.jspf</Include-coda> </Jsp-property-group> <Jsp-property-group> <Url-pattern>/admin/*</Url-pattern> <page-encoding>UTF-8</page-encoding> <Default-content-type>Text/html</Default-content-type> <Include-prelude>/jspf/admin_header.jspf</Include-prelude> <Include-coda>/jspf/footer.jspf</Include-coda> </Jsp-property-group> </Jsp-config></Web-app>
JSP---web. XML to set different headers and bottoms in the front and back