Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:include

 
mysha ahamed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a dbt in
1.include directive and
2.<jsp:inlcde> .
i read tht for 1. it is included at translation time n 2. is included at request time(run time)....
But both r compiled n executed at request time..So where does the basic difference for o/p comes in to picture...
Its given tht after the main jsp in which the file is included is translated n then if any changes r made to the included files,
with <jsp:inlcde> the changes r reflected but with include directive the changes r not reflected..I tried but the changes r reflected in both cases...
So whts the diff b/w the two with rgd to o/p apart frm performance issues..
Anyone pls expain..
Thnx.
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Translation and Requuest/Realtime are two different levels.
Translation happens when your jsp gets converted to the java code.
Request time is when the Servlet is servicing the request through its service method.

Basically what happens in first case, it is like getting jsp for the include file where it is called from and then translating the whole thing at once.

Where as in second case, you translate the main jsp and then do the include thing.
 
Srivatsa Katta
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Regarding ur second query that, u r able to see the changes made in the included file in the main file in both cases,
one using <jsp:include ..>
and the second using <%@include file=..%>

Herez what spec says..
" A JSP container can include a mechanism for being notified if an included file changes, so the container can recompile the JSP page. However, the JSP 2.0 specification does not have a way of directing the JSP container that included files have changed."

The above is taken for JSP Spec 2.0

So the container you are using is capable of getting notified when the included file is changed, then u can see the changes reflected even if u use include directive.

So its Container dependent, and the spec doesnot says that itz not possible.

Cheers!!
Srivatsa
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic