• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Help!!!!!  RSS feed

 
Belloumi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
How can I force a jsp file to be compiled each time it is loaded? I know it sounds weird, but I don't want to wait until the page changes so it would be recompiled. I mean is there anything I use inside the jsp file to force it to compile each time?
If anyone can help I'll be grateful and thnaks in advance.
 
Julia Reynolds
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this what you need? It is the tag you put in the <head> tag of your html to keep pages from caching.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
Julia
 
Maky Chopra
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
U dont make a JSP page compile everytime it is accessed. It is compiled the first time that it is accessed and then remains in the server memory until destroyed (like server shut down)
COmpiling it everytime would be such an enormous load on your server.. And the time people would wait to be served ?? No one will return to your site :-)
In fact, the preferred way is to pre-compile it on server start or page change (some servers have this option) so that users dont hafta wait.
 
Vikas Aggarwal
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!,
Sorry to inform you that the jsp is not compiled each time it is requested. You may ask the server to fetch a new copy of data evey time it is requested. The only way to make the jsp comlpile in TOMCAT is to remove all of the temp files from the tomcat and this will make the tomcat to compile the file again. Now to show the user refreshed data each time in JSP you can use
<%response.setHeader("Cache-Control","no-cache");%>
at the top most after nothing.
in the html <head></head> tag you can use meta tags.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Expires" content="now">
Originally posted by Mustapha Abella:
Hi there,
How can I force a jsp file to be compiled each time it is loaded? I know it sounds weird, but I don't want to wait until the page changes so it would be recompiled. I mean is there anything I use inside the jsp file to force it to compile each time?
If anyone can help I'll be grateful and thnaks in advance.


------------------
Vikas Aggarwal
Technology Associate
Shakun Global Networks
(http://www.vikinsa.com)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!