Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

include file directive, how the included jsp file is built?

 
Alton Hernandez
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have 2 jsp files where one is included in the other:
MAIN FILE: Test1.jsp

Included File aramRequest.jsp

When these codes are parsed, the resulting java files are as follows:
Test1_jsp.java

paramRequest_jsp.java

What I find interesting here is that part of the jsp code (starting from line Attributes in this Request:) that was in the included file[i]paramRequest.jsp[i] was not in its final generated java code, but instead can only be found in the generated main java file.
My question now is what made these lines different from the rest?
For your information I am using Tomcat 5.x.
Thanks.
Al
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Test1.jsp you have included ParamRequest.jsp statically and not dynamically, Hence all the generated code of ParamRequest.jsp is included in the generated java file for Test1.jsp.
If instead of
<%@ include file="/paramRequest.jsp"%>
you use
<jsp:include page="/paramRequest.jsp"/>
result will be different.
 
Alton Hernandez
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prakash,
But what I am wondering is why only part of ParamRequest.jsp is generated in the intermediate file ParamRequest_jsp.java.
If you take a look at the file ParamRequest.jsp, you will notice that the following codes are NOT in the ParamRequest_jsp.java.

Instead, they appeared in the Test1_jsp.java ONLY.
So why did the intermediate code ParamRequest_jsp.java ignored these lines?
[ February 24, 2004: Message edited by: Alton Hernandez ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic