File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes restarting tomcat?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "restarting tomcat??" Watch "restarting tomcat??" New topic

restarting tomcat??

scottie zman
Ranch Hand

Joined: Aug 08, 2001
Posts: 40
I would like to know if there is a way to refresh included files in a jsp without restarting Tomcat.
This is a problem for me because
1) I don't want to wipe out all the active sessions on the server
2) When I do restart Tomcat, it doesn't always pick up on the changes in the include file; it keeps using the older versions. Does anyone know why this is??
Thanks very much
mocca az
Ranch Hand

Joined: Mar 07, 2001
Posts: 93
You are not being very specific on what are you trying to accomplish. More details would be much more helpful for everyone in order to give you more answers.
m, phx
scottie zman
Ranch Hand

Joined: Aug 08, 2001
Posts: 40
Yea I guess it was kind of abiguous. I'm new to JSP and I'm basically trying to accomplish some similar results (to start with, anyway) as what I'm able to get with asp.
The thing about includes in JSP is that once you compile the page it doesn't check to see if the included file ever changes. Since the posting of my last message, I've learned about using dynamic includes, which are a bit better, but those don't have any session scope other than explicit parameters sent to it. And it doesn't seem that I could pass any objects or result sets or xml to a dynamically included file (please correct me if I'm wrong)
Basically, what I'm trying to accomplish is...
to have a chunk of code -- jsp/html that is within the scope of the page/session that I can include into a jsp, and update at any time without restarting the server.
I'm still wrapping my head around tag libraries- can this be accomplished with them? or do I just have to write a bean that produces the html? that seems like it would be a bad idea. I'm sure there's a way of doing this...
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

You can pass parameters to the included resource.

The included resource has the request/response object of the including resource. Also you can pass in other parameters, but as far as i know, they can only be name/value string parameters.

Check this post out (my posts are at the bottom)
the part that would interest you is in my last post, where I (painfully) describe that something that is statically included can still contain dynamic content. Or.. you can dynamically include both static and dynamic content.

However, the catch being... is your servlet runner smart enough to know that when jasper (the JSP compiler) is going out to fetch the jsp to be 'dynamically included'... will it check to see if THIS resource needs to be recompiled? In other words, do you need to access the included resource individually to enable the servlet runner's 'smart' checking of "has this changed or not". I would hope it would do the dynamic include properly (ie: if you change the included file, it would pick up those changes), but I admit I've never tried it.

Hope that helped.
[This message has been edited by Mike Curwen (edited August 25, 2001).]
I agree. Here's the link:
subject: restarting tomcat??
jQuery in Action, 3rd edition