Design page, head, navigation bar, foot, all the pages are basically consistent, do not repeat the design on each page, and the use of the general part of the stored as one of the JSP page, using the page only need to refer to the pattern
There are 2 different ways to introduce JSP pages
1. <%@ include file= "included.html"%> This is called a JSP include pseudo instruction
<! [cdata[
<%@ page language= "java" contenttype= "text/html"%>
|
This way is the older way, the disadvantage is not timely refresh, can not pass parameters, therefore, this method can not use
2. jsp:include Mark
<! [cdata[
<%@ page language= "java" contenttype= "text/html"%>
|
Can pass parameters:
<jsp:include page= "header.jsp" flush= "true" > <jsp:param name= "pagetitle" value= "newinstance.com"/> < Jsp:param name= "Pageslogan" value= "/> </jsp:include>
Header.jsp can take the parameters directly out:
<%= Request.getparameter ("PageTitle")%>
Reference page to note:
Applied pages, cannot contain HTML body tag, can reference CSS
Example page:
<%@ page contenttype= "text/html charset=gb2312" language= "java" import= "java.sql.*" "errorpage=" "%>
< Link href= "css/header.css" rel= "stylesheet" type= "Text/css"/>
<div id= "Maindiv"
<%= Request.getparameter ("PageTitle")%>
</div>