wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes page state is getting lost when back button is clicked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "page state is getting lost when back button is clicked" Watch "page state is getting lost when back button is clicked" New topic
Author

page state is getting lost when back button is clicked

Ravi Goli
Ranch Hand

Joined: Feb 13, 2005
Posts: 31
Hi all,

I am having a problem getting my page state/history work with the Back button.

I have two jsp pages.
In the first page, I am dynamically building a select dropdown 'A' based and replacing the earlier select when an onclick event happens on the dropdown button. This I am doing by appending my built innerHtml to the Div element around the Select input.
There is a radio buttons-'B' section on my page. I am also modifying the text for a <TD> section on the page based on the 'B' radio buttons selection.

Now, I select a value from the dropdown-'A', and and do a page submit.
From the 2nd page, I click on the browser Back button.
Now in the first page, I do not see my initial changes done to the DOM preserved.
By initial changes, I mean:
The dynamically populated Select dropdown, and the
Modifying of the text for a <TD> section are getting lost.

The dropdown is getting set to the initial dropdown that I had loaded when the page is laoded for the first time
Or I can say the page is reloading for the caseof these elements.

Please, let me know how to preserve my dynamically populated state.

Thanks in advance for any reponses.

Ravi.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Saving thee state is normally determined by the browser and you have no control over that.

You could store the values in a session cookie and look at the values on the page load event. If the values are there, you can set them through code.

Eric
Ravi Goli
Ranch Hand

Joined: Feb 13, 2005
Posts: 31
Thanks Eric for the response.

Right. Cookies is an option to get this work.

For Mozilla/Netscape history.next, history.previous, history[2], or so gives the location/url of the next/previous URLs.

Is there a similar way to access the URLs in the history object.

Thanks in advance.

Ravi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: page state is getting lost when back button is clicked
 
Similar Threads
problem with radio buttons in nested forEach loop
Ajax Calls not refereshed.
getting this Ajax code to work with jsp
How to dynamically "Check" the radio button based on condition
Radio Buttons