aspose file tools*
The moose likes JSP and the fly likes specifying the exact location to display a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "specifying the exact location to display a jsp" Watch "specifying the exact location to display a jsp" New topic
Author

specifying the exact location to display a jsp

vidula kulkarni
Greenhorn

Joined: May 24, 2001
Posts: 18
how can the exact location be specified,while displaying a jsp using jsp:include
Manjunath Subramanian
Ranch Hand

Joined: Jul 18, 2001
Posts: 236
Quote from Jsp 2.0 pfd specs, page 128,
PUBLIC DRAFT
JSP.5.4 <jsp:include>
A <jsp:include .../> element provides for the inclusion of static and dynamic
resources in the same context as the current page.
Inclusion is into the current value of out. The resource is specified using a
relativeURLspec that is interpreted in the context of the web server (i.e. it is
mapped).
The page attribute of both the jsp:include and the jsp:forward actions are
interpreted relative to the current JSP page, while the file attribute in an include
directive is interpreted relative to the current JSP file. See below for some
examples of combinations of this.
An included page only has access to the JspWriter object and it cannot set
headers. This precludes invoking methods like setCookie(). Attempts to invoke
these methods will be ignored. The constraint is equivalent to the one imposed on
the include() method of the RequestDispatcher class.
A jsp:include action may have jsp aram subelements that can provide values
for some parameters in the request to be used for the inclusion.
Request processing resumes in the calling JSP page, once the inclusion is
completed.
The flush attribute controls flushing. If true, then, if the page output is
buffered and the flush attribute is given a 'true' value, then the buffer is flushed
prior to the inclusion, otherwise the buffer is not flushed. The default value for the
flush attribute is 'false'
Examples
<jsp:include page=�/templates/copyright.html�/>
STANDARD ACTIONS 1-95
The above example is a simple inclusion of an object. The path is interpreted
in the context of the Web Application. It is likely a static object, but it could be
mapped into, for instance, a Servlet via web.xml.
For an example of a more complex set of inclusions, consider the following
four situations built using four JSP files: A.jsp, C.jsp, dir/B.jsp and dir/C.jsp:
� A.jsp says <%@ include file=�dir/B.jsp�%> and dir/B.jsp says <%@ include
file=�C.jsp�%>. In this case the relative specification �C.jsp� resolves to �dir/
C.jsp�
� A.jsp says <jsp:include page=�dir/B.jsp�/> and dir/B.jsp says <jsp:include
page=�C.jsp� />. In this case the relative specification �C.jsp� resolves to �dir/
C.jsp�.
� A.jsp says <jsp:include page=�dir/B.jsp�/> and dir/B.jsp says <%@ include
file=�C.jsp� %>. In this case the relative specification �C.jsp� resolves to �dir/
C.jsp�.
� A.jsp says <%@ include file=�dir/B.jsp�%> and dir/B.jsp says <jsp:include
page=�C.jsp�/>. In this case the relative specification �C.jsp� resolves to
�C.jsp�.
Syntax
<jsp:include page=�urlSpec� flush="true|false"/>
and
<jsp:include page=�urlSpec� flush="true|false">
{ <jsp aram .... /> }*
</jsp:include>
The first syntax just does a request-time inclusion. In the second case, the
values in the param subelements are used to augment the request for the purposes
of the inclusion.
HTH,
Manjunath
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: specifying the exact location to display a jsp