Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

is jsp change guaranteed to be picked up  RSS feed

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

If I change a JSP after I deployed it to a J2EE app. server, is it guaranteed by the J2EE spec that the container will see the JSP change and redeploy it?

If not, I do not see how jsp:include would work.

Say, My A.jsp includes B.jsp using jsp:include. After deployment, user accesses A.jsp for the first time, so, B.jsp is translated into a servlet and cached there.

Now I change B.jsp, if the container does not know the change, how would jsp:include work at runtime?

Thanks.
Yan
[ January 04, 2006: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Not all containers will.
With older versions of Tomcat, for instance, you needed to force a reload of the 'parent' JSP in order to get the included JSP to recompile.

Newer versions of Tomcat watch all JSPs and will reload if included pages are updated.
 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Report post to moderator
that means jsp:include is not guaranteed to be invoked on the latest version of JSP, right?
 
Aravind Kumar
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
Yes its not gauranteed. A simple solution would be changing the timestamp of the parent JSP.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
From the JSP 2.0 Spec:




JSP.1.10.3 The include Directive
The include directive is used to substitute text and/or code at JSP page translation-
time. The <%@ include file=´┐ŻrelativeURLspec´┐Ż %> directive inserts the text of
the specified resource into the page or tag file. The included file is subject to the
access control available to the JSP container. The file attribute is as in
Section JSP.1.2.1.
With respect to the standard and XML syntaxes, a file included via the include
directive can use either the same syntax as the including page, or a different
syntax. the semantics for mixed syntax includes are described in
Section JSP.1.10.5.

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


In other words:
Check your server's documentation.
[ January 04, 2006: Message edited by: Ben Souther ]
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Yan Zhou:
that means jsp:include is not guaranteed to be invoked on the latest version of JSP, right?


I think there is some confusion here.
The jsp:include will invoke the latest version of the JSP, since the control is actually transfered to the included JSP at run time.

In case of include directive, it may or may not pick up the changes made in the included JSP, depending on the container.
 
Sandip Chaudhuri
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am pretty positive it depends upon containers.
And I know from firsthand experience IBM Websphere does not, while TomCat 5 does.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66186
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator

IBM Websphere does not, while TomCat 5 does.


I guess that's the difference between a container you pay a lot of money for and one that's free. Oh wait a minute... :roll:
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Sonny Gill:


I think there is some confusion here.
The jsp:include will invoke the latest version of the JSP, since the control is actually transfered to the included JSP at run time.

In case of include directive, it may or may not pick up the changes made in the included JSP, depending on the container.


That's a good point.
The text I posted pertains to the include directive, not the include action.
This thread is something of a continuation of this one.

Bye the way, this is all covered in a FAQ entry in the JSP FAQ:
http://faq.javaranch.com/view?IncludesActionDirective
[ January 05, 2006: Message edited by: Ben Souther ]
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!