Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
12.1 Including Files at Page Translation Time
269
Listing 12.1 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(); %>
Listing 12.2 SomeRandomPage.jsp
Some Random Page
CONTENT="foo,bar,baz,quux">
CONTENT="Some random Web page.">
HREF="JSP Styles.css"
TYPE="text/css">
Information about our products and services.
Blah, blah, blah.
Yadda, yadda, yadda.
<%@ include file="ContactSection.jsp" %>
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved