Solved

Reloading JSP on back button click

Posted on 2004-10-19
7
853 Views
Last Modified: 2008-03-06
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?
0
Comment
Question by:srnambiar
7 Comments
 
LVL 36

Assisted Solution

by:Zyloch
Zyloch earned 25 total points
ID: 12355350
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
 

Author Comment

by:srnambiar
ID: 12355902
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
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 12356104
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

Expert Comment

by:Ryan Chong
ID: 12356110
or a javascript like: onclick="window.location.href = 'mypreviouspage.jsp'; " at cancel button maybe be useful too... ?
0
 
LVL 8

Accepted Solution

by:
sigmacon earned 75 total points
ID: 12366289
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
 
LVL 36

Expert Comment

by:Zyloch
ID: 12384674
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
 
LVL 49

Assisted Solution

by:Ryan Chong
Ryan Chong earned 25 total points
ID: 12388165
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to dynamically set the form action using jQuery.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now