I only started studying JSP/servlets about 3 or 4 months ago. One thing that bothers me a little is that when developing and testing JSP/servlets, one needs to restart Tomcat pretty often. But for development using other web technologies, such as PHP, restarting the web server is not necessary.
For all the veteran JSP/servlets developers out there, do you feel that having to restart Tomcat ofen is slowing down your web application development? Is it possible in the future that Tomcat server could detect changes in the class files and handle them automatically, without restarts?
PS: If you have some general advice for a JSP/servlets newbie, please let me know. [ April 08, 2007: Message edited by: Wilson Gordon ]
You never need to restart Tomcat -- well, almost never -- as a result of changing something. JSPs will automatically be picked up, and when a servlet is changed, you just need to restart the context. The Tomcat Manager app will help you out with that, or there are Ant tasks that I find very useful.
You can set up Tomcat to automatically reload the app when it detects a change, but I've found it to be spotty.
The manager app has two forms; an HTML version and a command line version that works with URL Querystrings.
This means, that if you work with the command line a lot as I do, that you can create an alias (or batch command for Windows) that reloads your app with one command.
You can also set the reloadable attribute to the <Context ../> element to true. With this attribute set to true, Tomcat will automatically reload your application if any of the classes in under /WEB-INF/classes or /WEB-INF/lib are recompiled.
Originally posted by Wilson Gordon: Thanks for the tips and info.
Do you know the equivalent batch command for Windows? For now, I just make a bookmark for the reload link so I can access it faster.
I'm much of a Windows script writer and I'm not sure if anyone's ported wget to that platform. If I wanted to do something like this, I would probably just write a small Java program using java.net.URLConnection or Jakarta's commons/httpclient and wrap it with a batch script.
In a nutshell, you just need any program that can make an HTTP request to the URL that reloads your webapp. It also needs to be able to pass a username and password in that request.
If you attach a debugger to your webapp while its running, break somewhere, and make a code change (works in Eclipse and IDEA), that change will be reflected instantly and you won't have to reload the context.
SCJP, SCJD, SCBCD, SCWCD
Joined: Apr 07, 2007
Thanks for the clarification and replies. I appreciate it.