• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Servlet not updating

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet ServletTest that generates an HTML page using class HTMLTest. It does a fine job of displaying the page in my browser, but when I change the code of HTMLTest, my browser still shows the old version. I've tried refreshing my browser (also using option and command keys) and I still see the old version of the page. HTMLTest outputs its page to a text file which gets updated fine, and I recompiled ServletTest (although it doesn't seem like I'd need to--it just calls the "create" method of HTMLTest) but I still see the outdated page.
I have a feeling it's a browser problem.... don't know how else to test the contents of the servlet.... Tried emptying my cache, didn't help. I imagine it's something simple, but I'm stumped for now. Here's my doGet servlet code, in case that's the problem somehow:
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println(HTMLTest.createDogPage());
out.close();
}

Thanks in advance for any help!
e
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen the following approach suggested to make sure the browser does not cache the page.
String tmp = request.getProtocol() ;
if (tmp.equals("HTTP/1.0")) {
response.setHeader("Pragma", "no-cache");
} else if (tmp.equals("HTTP/1.1")) {
response.setHeader("Cache-Control", "no-cache") ;
}
However, which servlet engine are you using? Some of them don't automatically reload a servlet class after the timestamp changes.
Bill


------------------
author of:
 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you cleared your browser history and internet temporary files?
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bowser history?? I mean browser history?? Haven't tried that.
About the previous code, where does this go--in the servlet? Or does it go with the server somewhere....
[edit: oh never mind. It's pretty obvious it goes in the servlet.]
In the meantime, I will try restarting tomcat to refresh, as suggested elsewhere in these pages.
Thanks all!
[This message has been edited by eric moon (edited December 14, 2000).]
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this mean sounds stupid, but did you recompile the servlets.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic