back button

In the content <div> I have a jsp . it has a back button . When user clicks on it, it should show the previous page in the content <div>.

Whats the approach ?
cofactorAsked:
Who is Participating?
 
cofactorAuthor Commented:
I have used session. I have kept all the data in session . when the user clicks back . I have revult the page fetching data from session.
0
 
Sathish David Kumar NArchitectCommented:
use window.history.forward() to go back the prvious page ?
0
 
cofactorAuthor Commented:
>>>use window.history.forward() to go back the prvious page ?

I want the previous page so back() is appropriate I think.

I tried  onclick="history.back();"   in the button ..but that does not work ...it throws the  login page.

But I want the previous page in the content <div>.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
leakim971PluritechnicianCommented:
Not possible with javascript. You may save the previous page with an unique id in a table (I mean save value of fields of that page) and when the user click on the div, rebuild the page with the fields and their saved value
0
 
leakim971PluritechnicianCommented:
you can load content of a page and put it easily in a div (or any other container) with jQuery and the function : http://api.jquery.com/load/

backupId = $("#backup").val();
$("#divId").load("previouspage.jsp?backupId=" + backupId + " body");

Open in new window

with

<input type="hidden" id="backupId" value="12345" />
<div id="divId"><!-- put previous page content(body) here --></div>

Open in new window

0
 
cofactorAuthor Commented:
solved myself
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.