JSF 2.0 Page Redirect

Home/JSF/JSF 2.0 Page Redirect

Simple JSF Page Redirect

By default, JSF forwards the page whenever user request page to the server. Follow the steps if you want to redirect the page,

1. Add parameter faces-redirect=true at the end of the URL

2. In faces-config.XML, Add element <redirect/> in the navigation rule

In page forward, JSF does not change the URL in the browser but for page redirect, JSF changes the URL. We usually use page redirect to avoid form resubmission

 

01-2-300x173 JSF 2.0 Page Redirect

JSF Page redirect

Example:

In this example, we created index.xhtml & dashboard.xhtml.  When user clicks the button in index page, JSF redirects the page to dashboard. 

index.xhtml

 

dashboard.xhtml

 

jsf-config.xml

We  added parameter faces-redirect=true at the end of the URL and <redirect/> in navigation rule.

Managed Bean

 

Download Source Code:JSF Page Redirection

pgn JSF 2.0 Page Redirect

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
pgn JSF 2.0 Page Redirect
By | 2016-02-27T19:58:21+00:00 February 27th, 2016|Categories: JSF|0 Comments
Like us on Facebook.
Connect!