Hi,
I am facing a problem while using RequestDispatcher to include the contents
of a text file. I'm using RequestDispatcher from within a JSP page to
include the contents of a text (common content) file. The format of the JSP
page is as follows:

---------------------------------------------------------------------------------
<HTML>
<BODY>

Some text........................

<%
   ServletContext ctx2 = application.getContext("/ssi");
   RequestDispatcher rd = ctx2.getRequestDispatcher
("/app/commonHeader.txt");
   rd.include(request, response);
%>

<jsp:include page="/servlet/SomeJavaServlet" flush="true"/>

This is some text garbage.............................

<%
   ServletContext ctx2_1 = application.getContext("/ssi");
   RequestDispatcher rd2_1 = ctx2_1.getRequestDispatcher
("/app/commonFooter.txt");
   rd2_1.include(request, response);
%>

</BODY>
</HTML>
-------------------------------------------------------------------------------------------------------------

The output to the browser doesn't show up in the order that was defined in
the JSP. The contents of the commonHeader.txt gets displayed before the
"Some text........................". Same with commonFooter.txt. It appears
before "This is some text garbage.............................".
Is this behaviour normal? The source code generated in the "work" folder in
the correct order. Maybe the RequestDispatcher is higher up in the oder of
execution.

I can't use <%@ include .....%> nor "<jsp:include...../> " directives since
the "ssi" folder is a defined as a different Servlet Context.

Any help/ideas/comments would be appreciated.

Thanks.
RS





--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to