Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes JSP and browser error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP and browser error?" Watch "JSP and browser error?" New topic

JSP and browser error?

Shuaib Gill
Ranch Hand

Joined: May 29, 2001
Posts: 62
I have a JSP which uses HTML forms in them. The form's action attribute sends the request to a servlet. This servlet processes the request and sends a response to a DIFFERENT JSP page. I made some changes to my JSP and servlet.
When I reloaded the page, the old versions of the JSP showed up. Why? I saved the jsp, and servlet in the correct directory. I compiled the servlet. But still the old version of the JSP shows up. Why does this happen?
Is it because the cache has versions of the old JSP? How can I correct this? I am using Netscape Navigator v 4.7 as my browser.
Why does it do this? How can I get rid of it?

anuj sahai

Joined: Dec 02, 2000
Posts: 8
I think this would depend on the web server/servlet engine u r using. If it does not support dynamic re-loadng. Are u restarting your webserver ? Which webserver r u using ??
matt hooker
Ranch Hand

Joined: Jul 26, 2001
Posts: 46
Hi Shuaib,
Are you using the Tomcat container ?
This is a common problem and is indeed because of caching. If you make a minor change to the root of the transaction (which I think would be the form page in this case) then the container should automatically be forced to reload the JSP's as well.
Hope this sorts you. Otherwise - if you are using Tomcat then the cache is somewhere like :
C:\Program Files\jakarta-tomcat-3.2.2\work\localhost_8080<context> where <context> is, strangely - your context.

Its not what you do, its the way you say you've done it.
Shuaib Gill
Ranch Hand

Joined: May 29, 2001
Posts: 62
I'm using Jrun 3.0 on my local machine. I make the changes, complie the .java files, restart the server and hit reload.
Nothing happens. When I changed a servlet to do a simple test, I commented out the RequestDispatcher so it would not forward the response to a JSP.
However I compiled the java program and it still went to the next jsp page upon user request. Why? How can I get rid of caching?
Sunetra Saha
Ranch Hand

Joined: Feb 25, 2001
Posts: 77
I think that this is not a problem with caching. I use Jrun and it works on the same lines as you mentioned without any caching problem. I think the problem might be something like the presence of a duplicate of the .class file in your classpath. Do a check for that.

Shuaib Gill
Ranch Hand

Joined: May 29, 2001
Posts: 62
yes I had multiple .class of the same java file, so I got rid of some of the ones I did not need. Well, I keep getting an error on my jsp pages.
When I hit submit from an html form, the servlet does some processing and forwards a response to a 2nd jsp. No prob, so far so good right? Well, when I do the same thing in a new session, the 2nd jsp says error on the browser, why?
srikanth bukkapatnam

Joined: Jul 31, 2001
Posts: 7
Usually this happens because of old JSP classes are not cleared. Changing a JSP should recompile the JSP, but sometimes it helps if you delete the old JSP classes.
I agree. Here's the link:
subject: JSP and browser error?
It's not a secret anymore!