This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes back button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "back button" Watch "back button" New topic
Author

back button

pooja jain
greenhorn
Ranch Hand

Joined: Jan 12, 2005
Posts: 213
what is the good way to implement back button?

one is history.go(-2), it looks good at first go. but there is an issue here:

it just shows the back page from browser history. this is what it is supposed to do.

but consider this scenerion:



assume there is a form and submit button on above page. now what happens is, in case of any invalid form field, we set error attribute to request, and we forward request to same page, and since request attribute is set, we will get this error message.

now user correct the form and submit again. this time no error so user go to next page. now on this next page there is a back button. if user clicks on it user will see the previous page with error. this is definitely wrong.

any suggestion here?
[ November 07, 2008: Message edited by: pooja jain ]

:d
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
You could consider using to prevent caching of page:



Please see: http://www.theserverside.com/discussions/thread.tss?thread_id=11078


Thanks and Regards
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Satya Maheshwari:
You could consider using to prevent caching of page:



Please see: http://www.theserverside.com/discussions/thread.tss?thread_id=11078


yes.. it is good. also maintain the session according to your needs
 
jQuery in Action, 2nd edition
 
subject: back button
 
Similar Threads
Directing login errors to form-login-page -- spurious login error message
bean problem
User filter
How i will display error details in the same jsp page
My First Struts App