• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Include Directive vs Include Action

 
Ernest Lee
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Velmurugan's study note:
================================================
� Include Directive - Translation-time
<%@ include file=�relativeURL� %>
Content is parsed by JSP container.
� Include Action - Request-time
<jsp:include page=�relativeURL� flush=true|false />
<jsp aram name=�� value=��|<%= expression > >
Content is not parsed; it is included in place. In case of dynamic resources the result from the processing is included.
================================================

What is "content is parsed" and "content is not parsed" means??
from my understanding, the URI included by include directive will be compiled in the translation time while URI included by include action will be included/compiled in run-time as needed.. am i right?
 
Tim Duncan
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It comes from Table JSP 2-1 in the spec, which summarises the differences between the include directive and the include action. The surrounding text is a wee bit easier to understand ... but not much
My understanding of it (which I shall shortly go away and test) is that the include directive <%@ include file=... %> allows a static resource to be included in the page at translation time, and it is then parsed/translated along with the rest of the JSP.
The include action on the other hand, <jsp:include page= />, is a request-time include, so it isn't involved in the translation stage. However, the resource that is included may be static or dynamic ... i.e. it could be the URL of another JSP, so the output produced by that (second) JSP is included without being parsed or translated by the first JSP.
HTH ...

[This message has been edited by Tim Duncan (edited November 28, 2001).]
 
Ernest Lee
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx Tim.
so... the output of using include directive and include action should be the same unless the included JSP is changed after the JSP using include directive was translated....in this case, the one which uses "include action" will be up to date, while the other one will be out dated...
right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic