File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes confused about the limitation of the jsp:include tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "confused about the limitation of the jsp:include tag" Watch "confused about the limitation of the jsp:include tag" New topic
Author

confused about the limitation of the jsp:include tag

Lucky Narayan
Greenhorn

Joined: Mar 29, 2002
Posts: 4
JSP gurus,
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 servlet 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 !!
--+
Main File:
<html>
<body>
<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" />
</body>
</html>
ToolBar.JSP:
<%
for (int i = 0; i< cookies.length; i++)
{
Cookie CurrentCookie = cookies[i];
String CookieName = CurrentCookie.getName();
String CookieValue = CurrentCookie.getValue();
out.println("Name1 : " + CookieName + ", Value1 : " + CookieValue + "<BR>");
}
%>
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 = "<I>No previous access</I>";
%>
<P>
<HR>
This page © 2000
<A HREF="http//www.my-company.com/">my-company.com</A>.
This page has been accessed <%= ++accessCount %>
times since server reboot. It was last accessed from
<%= accessHost %> at <%= accessDate %>.
<% accessHost = request.getRemoteHost(); %>
<% accessDate = new Date(); %>
Lucky Narayan
Greenhorn

Joined: Mar 29, 2002
Posts: 4
Why no one has responded to my question? :roll:
Help!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: confused about the limitation of the jsp:include tag