I wrote a simple Hello World servlet , compiled it and had it working on the web browser, so far so good. Next I changed the servlet, recompiled it and clicked on the Refresh button on the browser, nothing, no change. I have to shut down and restart the standalone Tomcat Apache engine each time I recompile the servlet, it is very tedious. Someone please help.
I am using: Tomcat 4.0.1 Windows 2000 Pro, SP2 IE 5.5
Here is my directory structure:
In server.xml, the only addition I've made is a test Context element between the manager context and the examples context:
In my web.xml under my webapp's WEB-INF directory, I have: Finally, my servlet code is: Starting Tomcat, and hitting the URL: http://localhost:8080/test/hello produces a page titled "Hello World!" with "Hello World!" in Big letters.
Going back to my servlet, and uncommenting the Small Change line, recompiling, and refreshing my browser, and I see a different page.. one that has "Small Change" right underneath Hello World.
The very first time I did this, I had to hold down the Shift key while I clicked on Refresh. For each subsequent change, (I put on "change 2, change 3, etc, etc...), a single click on the refresh seemed to work.
There are no 'special' considerations to be made. Just make sure you have the 'reloadable' attribute in your Context element set to true, and you should be fine. I had previously thought this was a default value, but I've tried it out, and it doesn't appear to work.
SOMETIMES, it will work if you use *just* the DefaultContext element, with reloadable=true. Other times, it will not. SOMETIMES, it will work with the DefaultContext, with reloadable=true, AND a test Context (missing a reloadable attribute). Other times it will not, or is SLOW to recognize the change.
BUT... I cannot get it to behave badly if I have the reloadable=true set into the test context. So I think the bottom line here is, make sure you make a context for each webapp, and explicity set it's reloadable attribute = true. Don't rely on the automatic DefaultContext (or even the automatic 'creation' of contexts from directory structures in webapps).
And after all that, I'm sure other people have different experiences using Tomcat on their machines. Oh, the joy of software development. [ February 14, 2002: Message edited by: Mike Curwen ]