Including Files at Page 
Translation Time
Format
<%@ include file="Relative URL" %>
Purpose
To reuse JSP content in multiple pages, 
where JSP content affects main page
Notes
Servers are not required to detect changes to the included 
file, and in practice many don t
Thus, you need to change the JSP files whenever the 
included file changes
You can use OS specific mechanisms such as the Unix 
"touch" command, or
<%   Navbar.jsp modified 3/1/02   %>
<%@ include file="Navbar.jsp" %>
51
JSP
www.corewebprogramming.com
Reusable JSP Content:
ContactSection.jsp
<%@ page import="java.util.Date" %>
<%   The following become fields in each servlet that
results from a JSP page that includes this file.   %>
<%! 
private int accessCount = 0;
private Date accessDate = new Date();
private String accessHost = "No previous access";
%>


This page © 2000 
my company.com.
This page has been accessed <%= ++accessCount %>
times since server reboot. It was last accessed from 
<%= accessHost %> at <%= accessDate %>.
<% accessHost = request.getRemoteHost(); %>
<% accessDate = new Date(); %>
52
JSP
www.corewebprogramming.com
26




  

Home

About Services Network Support FAQ Order Contact
 

Java Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved