tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Paransky <>
Subject Problem with the PageContext.include(...) api for jsp1.2 and jsp1 .1
Date Tue, 05 Sep 2000 22:00:15 GMT
I wish to use the PageContext.include(...) API from one of my tags.  The tag
is nested in bodies of other tags. When I use the PageContext.include(...)
the output goes directly to the ServletResponce output stream (as per spec
jsp1.2 or jsp.1.1), and not to the BodyContent of the tag within which it is

For example, if <sls:tag> produces string called "foo" (from doStartTag
method), and <sls:include> executes PageContext.include("bar.html") method
to include a page containing "bar" I would expect the following nesting:

     <sls:include />

To produce the following output:


Instead, the following output is produced:


It does not matter how deep I nest the sls:include, it always comes out
first, because the bodies of surrounding tags do not get a chance to output
until the last </sls:tag> executes
"bodyContent.writeOut(bodyContent.getEnclosingWriter());".  This problem is
due to the spec indicating that:

public abstract void include(java.lang.String relativeUrlPath)
                      throws ServletException
	Causes the resource specified to be processed as part of the current
ServletRequest and ServletResponse being processed by the calling Thread.
The output of the target resources processing of the request is written
directly to the ServletResponse output stream. 

The spec needs to change to allow PageContext.include (and forward for that
matter) to honor the current nesting of the BodyContext as defined by the
series of pushBody() api calls prior to the call of the PageContext.include

Please correct me if I am wrong.


View raw message