• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A puzzle on pageContext.include & request. getRequestDispatcher. include

 
Yorck Zhou
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, everybody,
I have three JSPs, they are a.jsp, b.jsp and test.jsp.
Can you tell me why the following codes run to a different result?
Please pay attention to the line "AAAAAAAAAAAAAAAA"
and the line "this is bbbbbbbbbbbbbb.jsp" in the results.
/////////////////////////////////////////a.jsp:
<br>this is aaaaaaaaaaaa.jsp
/////////////////////////////////////////b.jsp:
<br>this is bbbbbbbbbbbbbb.jsp
/////////////////////////////////////////test.jsp:
<html><body>
<br>AAAAAAAAAAAAAAAA
<%pageContext.include("a.jsp");%><%//pageContext line%>
<br>BBBBBBBBBBBBBBBB
<%request.getRequestDispatcher("b.jsp").include(request, response);%>
</body></html>
the output in the IE browser:
AAAAAAAAAAAAAAAA
this is bbbbbbbbbbbbbb.jsp
this is aaaaaaaaaaaa.jsp
BBBBBBBBBBBBBBBB
/////////////////////////////////////////test.jsp
//(with the line
//< %pageContext.include("a.jsp");% >< %//pageContext line% >
//deleted):
<html><body>
<br>AAAAAAAAAAAAAAAA
<br>BBBBBBBBBBBBBBBB
<%request.getRequestDispatcher("b.jsp").include(request, response);%>
<br>CCCCCCCCCCCCCCCC
</body></html>
the output in the IE browser:
this is bbbbbbbbbbbbbb.jsp
AAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBB
thanks!
[ March 12, 2004: Message edited by: Yorck Zhou ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic