Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in JSP&Servlets-cache??  RSS feed

 
Mark Henryson
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am Learning JSP and Servlets in Tomcat5.0, JDK1.5.
In a servlet I misspelled one method(setAttribute() as setAttributes()) and compiled it and reported an error message for it. Then I changed it to the right one(setAttribute() and I compiled it without any error.
I had shutdown the tomcat server and restared it. When I tried to open that page, I am getting the error message that I am using the wrong method setAttributes().

Whether it is due to cache problem. How to resolve it?
What are the steps needs to be taken whenever we are making some changes to the sevlets,JSP files?
Why we start and stop the tomcat server? I am using Head First Servlets and JSP. In that book, after compiling each servlets file, they shurdown and restart the server. why we are doing this? What are the advantage of doing it?

There are any options to do it without shutdown and srestart the tomcat server each time.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For your first question:
The caching could have taken place in your browser.
Try clearing your browser's cache

Another possibility is that Tomcat isn't noticing your updated JSP files.
If the dates on the generated servlet src or classes are off, Tomcat may not have realized that you had updated the JSP.
If you delete the TOMCAT_HOME/work directory, you will force Tomcat to recompile all the JSPs.

The reason the book was having you re-start Tomcat is that the servlet classes
get loaded when you use them and stay loaded from that point on.
If you recompile your servlet, you need to stop and restart the app to get them to load.

There is an attribute to Context that you can set to make Tomcat automatically reload your app whenever a class file gets updated.
Look for reloadable
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html
[ September 15, 2005: Message edited by: Ben Souther ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!