You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Jason Vincent <jt...@gmail.com> on 2006/09/15 22:46:11 UTC

Backbutton expired pages that had validation errors

Hi all,

Here is my situation:

1) the user submits a form which produces a validation error.
2) JSF catches the error and "forwards" the browser back to the previous page.
3) the user fixes the validation error, and resubmits the page.
4) JSF uses the "action" results and uses a navigation rule that
"redirects" the user to the next page.
5) the user then hits the browser back button.
6) the browser then presents the user with an "Expired Page" message
asking if they wanted to resubmit the data that was entered in step 1.

I was hoping there was a slick way to avoid that "Expired Page" message.

I was thinking that on a successful action invocation that I would set
some variable, and have the navigation rule send the user back to the
first page.  Then in the first page's Init method I would, check that
variable, and force an action that would "redirect" the browser to the
second page.  I suppose this would only give 1 level of history to go
back to, but it would be a nicer user experience (hitting the back
button a second, would still show the "epired page" message.

1) Is that approach simple enough?
2) Is there a way to get JSF to "redirect" on validation errors.
Since JSF is storing it's state in session, It seems like it should be
able to recover it's state after the redirect.
3) Instead of using externalContext.redirect(url), I'd like to take
advantage of the JSF navigation rules - how do I invoke an action
event from the init method?

Thanks in advance.
Jason