Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

include directive vs standard action

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why include directive is said to be not dynamic?

In HFSJ, they are referring to rollit function and they are trying to say dynamic and in the place where they are explaining params, they tell that it doesnt apply to directive as it is not static?

Please clarify.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,


this is static include ,here you can not pass parameter to the include page but you can do this in <jsp:include page="myjsp.jsp?key=value"/> this is dynamic inclusion
 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanted to post a trivial doubt on same topic jsp:include Vs @ include.

A.jsp



C.jsp



B.jsp



Now As HFSJ mentions that @ include does everything @ translation time i.e. it copies code of B.jsp into A.jsp and then created instance of servlet A. As such it is more often used for pages which are not updated regularly.

<jsp:include> on the other hand includes a runtime call for B.jsp inside A.jsp and with every request accesses output of B.jsp @runtime.

But in this case how would the difference between jsp:include and @include play out for two subsequent requests to A.jsp and C.jsp??

As per my understanding display would be different for each subsequent request to A.jsp or C.jsp.

Display @ FIRST Request Call to A.jsp ====>

The current date and time are

Feb 27, 2009 21:38:40



Display @ SECOND Request Call to A.jsp ====>

The current date and time are

Feb 27, 2009 21:40:40



Display @ FIRST Request Call to C.jsp ====>

The current date and time are

Feb 27, 2009 21:42:40



Display @ SECOND Request Call to C.jsp ====>

The current date and time are

Feb 27, 2009 21:44:40



So is the difference only related to static HTML, images etc. ???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic