Reloading JSP on back button click

Hi,

I am using JSP/javascript in my application.
When a user navigates from one page to another and clicks on the back button I want to reload the previous page via a server call instead of loading it from browser cache.
I am currently using POST method for form submission.

Any idea how I can acheive this?
srnambiarAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sigmaconConnect With a Mentor Commented:
If a page was downloaded by a browser client as response to a form submission and that page needs to be reloaded, usually because of the no-cache headers set as pointed out by Zyloch, THAN IT IS UP TO THE BROWSER WHETHER A MESSAGE IS SHOWN TO RELOAD THE PAGE. Some have user settings to control that. But that's browser specific. One first suggestion I have is to replace the form method POST with GET. That surely would work. If that's not possible, please respond.
0
 
ZylochConnect With a Mentor Commented:
Hi srnambiar,

You can try setting no-cache headers.
http://www.jguru.com/faq/view.jsp?EID=377&page=2 has the details.

Regards,
Zyloch
0
 
srnambiarAuthor Commented:
If I set the no-cache headers I get a warning message saying that the page has expired.
I do not want this message to appear. Instead I want the previous page to reload.
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
Ryan ChongCommented:
No Choice, if you don't want to set cache header, you may need to POST to your previous page from your cancel button.
0
 
Ryan ChongCommented:
or a javascript like: onclick="window.location.href = 'mypreviouspage.jsp'; " at cancel button maybe be useful too... ?
0
 
ZylochCommented:
Yes, sigmacon is right. The Page Expired is caused by using POST. If you don't have sensitive info and not too much of it, use GET.

By the way, I read somewhere that the no-cache headers will only work in IE if the document is less than 64kb? Must be a bug in IE..
0
 
Ryan ChongConnect With a Mentor Commented:
I got problem regarding jsp file cannot exceed 64kb before, my solution is to 'chop' the jsp file into many pieces, then make them as include files, and my problem resolved 8-)

so, srnambiar. Which way you prefer to go? ;-)
0
All Courses

From novice to tech pro — start learning today.