A
Antony Sequeira
Hi
I am trying to display a jsp which tries to include content from two
other jsps that come from other contexts. The result is not what I
expect. The content is not output in the same order that it is included
in.
(The application I am working on is under development and the above is
really an explanation of the way I am reproducing the bug. So, using
content from other contexts and including it in right order is what I
expect to be able to use, even though for this simplified reproduction
there are obviously simpler ways to do things.)
Here is the setup I have.
Download and expand jetty 6.0.2
Under the webapps dir create the following dir structure
ct1
ct1/WEB-INF
ct1/WEB-INF/web.xml
ct1/j1.jsp
ct3
ct3/j3.jsp
ct3/WEB-INF
ct3/WEB-INF/web.xml
ct2
ct2/WEB-INF
ct2/WEB-INF/web.xml
ct2/j2.jsp
All the web.xml files contain the following content
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>WebApp 1</display-name>
</web-app>
The three jsp files contain the following
---- contents of file ./ct1/j1.jsp-----
<p/>j1.jsp <%=new java.util.Date() %><p/>
---- contents of file /ct2/j2.jsp-----
<%
application.getContext("/ct1").getRequestDispatcher("/j1.jsp").include(request,response);
Thread.sleep(2000);
%>
<p/>j2.jsp <%= new java.util.Date() %><% Thread.sleep(2000); %><p/>
<%
application.getContext("/ct3").getRequestDispatcher("/j3.jsp").include(request,response);
Thread.sleep(2000);
%>
-----contents of file /ct3/j3.jsp-----
<p/>j3.jsp <%= new java.util.Date() %><p/>
--------------------------------------------------------
When I access the j2.jsp file (from browser or direct telnet) I get the
following
<p/>j1.jsp Wed Dec 06 22:26:32 PST 2006<p/>
<p/>j3.jsp Wed Dec 06 22:26:36 PST 2006<p/>
<p/>j2.jsp Wed Dec 06 22:26:34 PST 2006<p/>
I expected content of j3 to be at the end. The Date print was added just
to show the execution sequence is correct.
I had this issue in the app when using jetty 5.1 as well as jetty 6.0.2
in a embedded fashion. So the above is a very simple reproduction
involving minimal code from me.
I could try this with tomcat, unless someone is kind enough to that for me.
I don't understand this behavior and would like some pointers.
Thanks,
-Antony
I am trying to display a jsp which tries to include content from two
other jsps that come from other contexts. The result is not what I
expect. The content is not output in the same order that it is included
in.
(The application I am working on is under development and the above is
really an explanation of the way I am reproducing the bug. So, using
content from other contexts and including it in right order is what I
expect to be able to use, even though for this simplified reproduction
there are obviously simpler ways to do things.)
Here is the setup I have.
Download and expand jetty 6.0.2
Under the webapps dir create the following dir structure
ct1
ct1/WEB-INF
ct1/WEB-INF/web.xml
ct1/j1.jsp
ct3
ct3/j3.jsp
ct3/WEB-INF
ct3/WEB-INF/web.xml
ct2
ct2/WEB-INF
ct2/WEB-INF/web.xml
ct2/j2.jsp
All the web.xml files contain the following content
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>WebApp 1</display-name>
</web-app>
The three jsp files contain the following
---- contents of file ./ct1/j1.jsp-----
<p/>j1.jsp <%=new java.util.Date() %><p/>
---- contents of file /ct2/j2.jsp-----
<%
application.getContext("/ct1").getRequestDispatcher("/j1.jsp").include(request,response);
Thread.sleep(2000);
%>
<p/>j2.jsp <%= new java.util.Date() %><% Thread.sleep(2000); %><p/>
<%
application.getContext("/ct3").getRequestDispatcher("/j3.jsp").include(request,response);
Thread.sleep(2000);
%>
-----contents of file /ct3/j3.jsp-----
<p/>j3.jsp <%= new java.util.Date() %><p/>
--------------------------------------------------------
When I access the j2.jsp file (from browser or direct telnet) I get the
following
<p/>j1.jsp Wed Dec 06 22:26:32 PST 2006<p/>
<p/>j3.jsp Wed Dec 06 22:26:36 PST 2006<p/>
<p/>j2.jsp Wed Dec 06 22:26:34 PST 2006<p/>
I expected content of j3 to be at the end. The Date print was added just
to show the execution sequence is correct.
I had this issue in the app when using jetty 5.1 as well as jetty 6.0.2
in a embedded fashion. So the above is a very simple reproduction
involving minimal code from me.
I could try this with tomcat, unless someone is kind enough to that for me.
I don't understand this behavior and would like some pointers.
Thanks,
-Antony