This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes reloading of JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "reloading of JSP page" Watch "reloading of JSP page" New topic
Author

reloading of JSP page

shikhar singh
Ranch Hand

Joined: Oct 02, 2000
Posts: 31
Hi all,
I am loadin the Jsp page in a particular frame with the help of 'open()' function as given below,
open("nameofpage.jsp", "framewheretoload");
But my problem is:
First time the browser loads the Jsp page properly with all the values fetched and displyed in a drop-down-list box. These values are fetched from database.
But if I change these values from some other page and comes back to the previous one, the latest values are not displayed (jsp is not reloaded), and the old page is loaded again.
This is I think due to the caching of the browser.
But If I clear the cache of the browser and work again it works fine.
Can anybody suggest me a way to code the jscript in such a way that everytime it reloads the JSP page and displays the updated data.
Kindly send me your suggestions.
Hope to get some help
thanks in advance
shikhar
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
This is a fairly well known problem, and the solution depends on which browser(s) you want to support. I do most of my testing with Netscape, for which I know you need to send a "pragma: no-cache" header to prevent the broswer caching the page. There is another way of doing it for IE, but I don't have that to hand.
Search here and on the net in general and you should find the answer fairly quickly.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
shikhar singh
Ranch Hand

Joined: Oct 02, 2000
Posts: 31
Hi Frank,
Thanks very much for the reply. I am using IE as my browser. I tried to look on the net but couldn't find any help. Can you tell me whether I can use the same command you've given for IE also. If yes, can you give me the exact syntax and where to put this. Or can you suggest me some site which could be helpful.
Thanks for you patience and help..
Shikhar
Kapil Agrawal
Greenhorn

Joined: Nov 03, 2000
Posts: 11
These links could be of some help to you:
http://support.microsoft.com/support/kb/articles/Q234/0/67.ASP
and http://support.microsoft.com/support/kb/articles/Q222/0/64.ASP
shikhar singh
Ranch Hand

Joined: Oct 02, 2000
Posts: 31
Hi ,
Thanks for the help. I've tried the following code in the HTML.:
<HTML><HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD><BODY>
</BODY>
</HTML>
But this is not helping me. The problem still persists.
Actually let me explain the whole thing:
I have a JSP page called whole.jsp, which has two frames as under:
"
<frame name="rulesMain" src="rulesmain.jsp marginwidth="0">
<frame name="ruleDetail" scrolling="auto" marginwidth="0">
"
Now in first frame the source file is rulesmain.jsp.
In rulesmain.jsp I call a Jscript function, which in turn loads the JSP file called rulesdetail.jsp in the second frame i.e. ruleDetail, by calling this function:
"
open("rulesdetail.jsp",RuleDeail");
"
This function loads the JSP in second frame.
Now everytime I loads whole.jsp, It first loads rulemain.jsp and then loads rulesdetail.jsp.
Now my problem is that when I reloads the page whole.jsp, it reloads the rulesmain.jsp to the first frame with latest data but does not reloads rulesdetail.jsp. It just takes the page from the IE cache and displays the page with old data.
Hope this makes sense and is clear.
Pl help me and give me some helpful suggestion.
Thanks in advance
Shikhar

Brett Knapik
Ranch Hand

Joined: Oct 15, 2000
Posts: 255
i dont know if this will help but in the apache conf filet here is an option for cacheing i dont know if it pertains to the browser or the web server
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
shikhar singh
Ranch Hand

Joined: Oct 02, 2000
Posts: 31
Hi Brett,
I think that might pertain to the web server, not the browser.
thanks
Shikhar
shikhar singh
Ranch Hand

Joined: Oct 02, 2000
Posts: 31
Hi,
Can somebody llok into the problem and help me.
Thanks
Shikhar
david david
Greenhorn

Joined: Nov 04, 2003
Posts: 1
I have the same problem, some how the tomcat did not reload the jsp.
Any pro. can help us? --JSP pro please..
B Mampilli
Ranch Hand

Joined: Aug 05, 2002
Posts: 61
Hi all,
I faced the same problem a few days back...
Tried all the things that u specified...
The problem is not related to caching, etc...
It is related to the use of frames...
Check what you have specified as the target for the frames...
Also take a look at the question i had posted...
and the solutions i had got...
http://www.coderanch.com/t/283691/JSP/java/Forcebly-translate-recompiling-JSP


Boney
SCJP, SCWCD
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

You might want to try the following:

<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">

also, if you're going to be using your browser for development, then turn off all the caching in your browser, just to be 100% sure.
 
Don't get me started about those stupid light bulbs.
 
subject: reloading of JSP page
 
Similar Threads
Strange Logout back button problem
Trying to access an arraylist or a cart object from a jsp page
regarding getting updated values in JSP on the fly
How to retain the values selected in the jsp page when traversing back from a pop up jsp?
Opening a file