A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
confused about the limitation of the jsp:include tag
Joined: Mar 29, 2002
Apr 01, 2002 14:59:00
I am confused about the limitation of the jsp:include tag. This is what the Marty Hall book says:
"The jsp:include action includes files at the time of the client request and thus does not require you to update the main file when an included file changes. On the other hand, the page has already been translated into a
by request time, so the included files cannot contain JSP. Although the included files cannot contain JSP, they can be the result of resources that use JSP to create the output"
Below are my 3 files: main file which includes the 2 JSP files. I am thinking that since the 2 included files - ToolBar.jsp and ContactSection.JSP have JSP tag, this should result in an error. But this works fine! I am confused
Any suggestions/pointers appreciated !!
<h1>This is the main page</h1>
<jsp:include page="/jsp/test/ToolBar.jsp" flush="true" />
<jsp:include page="/jsp/test/ContactSection.jsp" flush="true" />
for (int i = 0; i< cookies.length; i++)
Cookie CurrentCookie = cookies[i];
CookieName = CurrentCookie.getName();
String CookieValue = CurrentCookie.getValue();
out.println("Name1 : " + CookieName + ", Value1 : " + CookieValue + "<BR>");
<%@ 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 = "<I>No previous access</I>";
This page © 2000
This page has been accessed <%= ++accessCount %>
times since server reboot. It was last accessed from
<%= accessHost %> at <%= accessDate %>.
<% accessHost = request.getRemoteHost(); %>
<% accessDate = new Date(); %>
Joined: Mar 29, 2002
Apr 02, 2002 11:00:00
Why no one has responded to my question?
I agree. Here's the link:
subject: confused about the limitation of the jsp:include tag
Access Counts in JSP
difference between include directive &action tag
Problem with forward and include JSP tag
Can JSP's include servlets?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014