File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes changes to included file not being picked up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "changes to included file not being picked up" Watch "changes to included file not being picked up" New topic
Author

changes to included file not being picked up

gino jersey
Greenhorn

Joined: May 24, 2005
Posts: 21
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

Joined: Jan 10, 2002
Posts: 61101
    
  66

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
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

Joined: May 22, 2005
Posts: 24
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

Joined: Jan 10, 2002
Posts: 61101
    
  66

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

Joined: Jan 10, 2002
Posts: 61101
    
  66

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: changes to included file not being picked up