Re: Server action and redirection

Splash Forums PrettyFaces Users Server action and redirection Re: Server action and redirection

#21421

No, the pages are independent. You are just setting the properties in the foreign bean to allow PrettyFaces to generate the correct URL to redirect the user to. Let me show this in an example.

Imagine a form some user submits and you want to take the user to a product details page after that.

Request 1 (POST-Request: The user submits the form)

– Your action method gets invoked

– You do whatever you want to do to process the postback

– Set the productId property on the ProductDetailPageBean

– Return pretty:productDetails

– PrettyFaces reads the productId from the bean and generates the target URL.

– PrettyFaces redirects the user to: /product/123456

Request 2 (GET-Request: The browser requests /product/123456)

– PrettyFaces injects 123456 back into the ProductDetailPageBean

– Your action method of ProductDetailPageBean gets invoked

– More…

You see how it works. It’s just an implementation of the Post-Redirect-Get Pattern [1].

Christian

[1] http://en.wikipedia.org/wiki/Post/Redirect/Get