Hi Techies, I have a weird requirement(can't help it as decisions are not in my hand). In My JSP(register.jsp), there are multiple fields like text boxes, radio buttons etc and a terms and conditions link. The "terms and conditions" page has to open up in same window(This is done so that user journey is not affected). If user clicks browser's back button from terms and conditions page, register page should show up with all the fields that user might have entered. So far so gud.
But Problem is register.jsp cant be cached. So I included all the no-cache meta tags. It is working fine with no caching in place. But the problem is that if user clicks the back button from terms and conditions page, the register.jsp fields are cleared(as expected). I want that the page shouldn't be cached but if the user comes from browser back button, these fields should not be cleared.
I know it is weird that i want and at the same time I dont want caching. But I can't help it. Is there any 'accepted' way for doing this?
Thanks in advance.
Dreams are not what you get when you sleep...It is something which don't let you sleep
Use a java bean instance to store the values, when the user clicks the "Terms and conditions" link, store the form values in the bean and when he clicks "back to form" populate the values from the bean. Isn't that simple?
Joined: Jan 09, 2008
Joined: Oct 30, 2007
so probably linking the link to some action to do so.
yes thatz correct.
I don't know how to handle the back button scenerio...
@Sandeep saahil I guess the proper way of doing this is to have 'Terms and conditions' opening in a separate pop-up with an 'Agree'/'Disagree' button. But as you have stated, that is not an option.
Since you are not caching the page contents, it means the browser back button is actually fetching the page from the server. So you can consider keeping the form values entered on the page in HttpSession. Everytime you render the page, you should check if values are present in HttpSession for it, and if they are, you can populate those. Will it work for you?
Thanks and Regards
Joined: Oct 30, 2007
Please use real words...
Oops!! My bad, missed that somehow.
I think if the page is fetched from the browser on clicking of back button, (As stated) then you can go ahead with the bean stored in the 'session' scope as discussed.