Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

changes to included file not being picked up

 
gino jersey
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We include a page that contains links. The code is:
<%@ include file="/jsp/include/links.inc" %>

We changed links.inc, but the changes are not being picked up by some pages.

We noticed some of our JSP pages that use this include AND were changed recently picked up the changes. But the other JSP pages that we left alone did not pick up the changes.

We have a lot of JSP pages that use this include and we'd hate to have to "touch" or change them all just so the change in the included file is picked up.

Any other solutions? Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Older version of Tomcat are not sensitive to changes in file included via the directive. Tomcat 5, I believe, does pick up such changes.

Btw, the conventional suffix for included JSP fragments is .jspf.
[ November 03, 2005: Message edited by: Bear Bibeault ]
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use <jsp:include page="..."/> instead. Unless you're using Tomcat. Include directive is not supposed to pick up changes to include files.
 
Jonathan Cone
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everyone here has been very helpful to me so I'll take a crack at it:

You're using the include directive. Basically, you're telling the container to take everything in that 'links.inc' file and paste it into the JSP which results in a servlet generated with the contents of your 'links.inc' file embedded in it. Since you aren't changing the JSP at all, the container is none the wiser because the JSP hasn't changed.

What you probably want is the include standard action, which looks something like this:
<jsp:include page="/jsp/include/links.inc" />

The difference is that, at runtime, the container will insert the contents of this file at the point in your JSP where you used this include action.

The include directive includes the information at JSP compile time the JSP standard action includes it at runtime. Make sense?

Good luck!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use <jsp:include page="..."/> instead.


The include directive and include action are not necessarily inter-changable. They act completely differently (translation-time vs run-time inclusion) and you can't just recommend using the action over the directive without knowing what the purpose of the inclusion is.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you aren't changing the JSP at all, the container is none the wiser because the JSP hasn't changed.


As I mentioned: some containers, such as Tomcat 5, are the wiser.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic