Java EE (04) page Common part common method jsp:include use __js

Source: Internet
Author: User
Tags cdata

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>




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.