<%@ include%>: All code is included and processed together and eventually compiled into a servlet.
Adding top and bottom.jsp pages to the JSP file
emplist.jsp
<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"%><%@ taglib URI="Http://java.sun.com/jsp/jstl/core"prefix="C" %><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Web01</title><styletype= "Text/css">Body{Margin-left:100px;}table, TH, TD{Border:1px solid Black;}</style></Head><Body><%@ include file="top.jsp" %><formAction= "/web01/empcontroller"Method= "Get">Employee Name:<inputtype= "text"name= "Searchtxt"><inputtype= "Submit"value= "Search"><BR/><Table> <TR> <th>Employee number</th> <th>Employee Name</th> <th>Position</th> <th>Leader number</th> <th>Date of employment</th> <th>Wages</th> <th>Bonus</th> <th>Department number</th> </TR> <C:foreachItems= "${requestscope.empbean}"var= "EMP"> <TR> <TD>${emp.empno}</TD> <TD>${emp.ename}</TD> <TD>${emp.job}</TD> <TD>${emp.mgr}</TD> <TD>${emp.hiredate}</TD> <TD>${emp.sal}</TD> <TD>${emp.comm}</TD> <TD>${emp.deptno}</TD> </TR> </C:foreach></Table></form><%@ include file="bottom.jsp" %></Body></HTML>
top.jsp page
<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"%><H1>Employee Management System</H1><HR>
bottom.jsp page
<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"%><%@ Page Import="java.util.*, com.test.common.util.*" %><HR>Query result time is<%=Dateutil.formatdatetostr (New Date())%>
Test results:
JSP <%@ include%> example