I am currently porting webapps to Tomcat(4.1.27) from WL and believe I may have found 
a bug with the 
implementation of the jsp:include action tag. The problem I found is that when using 
the jsp:include tag in a page which resides in a context which differs from the 
request's initial context the page being included is not found. (The crossContext 
attribute of the Context element has been set to true.) 

An example may better explain this:

WebappOne
        one.jsp source:
                WebappOne/one.jsp<br>
                <% 
config.getServletContext().getContext("/WebappTwo").getRequestDispatcher("/two.jsp").include(request,response);
 %>

WebappTwo
        two.jsp source:
                WebappTwo/two.jsp<br>
                <jsp:include page="/three.jsp" flush="true"/>
        
        three.jsp source:
                WebappTwo/three.jsp 


The text inside of WebappTwo/three.jsp will not be included in WebappTwo/two.jsp 
output when requesting WebappOne/one.jsp. However, if we move WebappTwo/three.jsp to 
WebappOne the output is included in the output of WebappTwo/two.jsp. 

I think that the cause of this is that JspRuntimeLibrary.include(...) uses the request 
to obtain a RequestDispatcher and the request is pointing to the initial context:

RequestDispatcher rd = request.getRequestDispatcher(resourcePath);
rd.include(request, new ServletResponseWrapperInclude(response, out));

The JSP 1.2 spec seems to say that jsp:include should be relative to the current page:

"A <jsp:include .../> element provides for the inclusion of static and dynamic
resources in the same context as the current page."

Thanks,
Greg Holtfreter
Software Engineer
Encyclopaedia Britannica  


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to