JSF 2 Flash Scope Example

JSF-Thumbnail

To minimize session scope bloat, it makes sense to use scope of request as much as possible. Without the redirect element, you can use request scoped beans that are shown in the next view. However, consider what happens with a redirect. The client sends a request to the server. The request scope map is populated […]

JSF 2 UI Debug Example

JSF-Thumbnail

When you place the ui:debug tag in a Facelets page, a debug component is added to the component tree for that tag. If the user types a hotkey, which by default is CTRL+SHIFT+d, JSF opens a window and display the state of the component tree and the application’s scoped variables. You can click on the Component Tree […]

JSF 2 UI Remove Example

JSF-Thumbnail

Sometimes, to find out which part of a jsf view causes a stack trace, you may want to use the time-honored divide-and-conquer strategy of commenting out parts of the page to isolate the offending component. Somewhat surprisingly, the XML comments <!– … –> are not useful for this purpose for example when you comment out a […]

JSF 2 Dynamic Target View ID (to-view-id) Example

JSF-Thumbnail

The to-view-id element can be a value expression, in which case it is evaluated. The result is used as the view ID. This type of providing of to-view-id isn’t implemented before JSF 2.0. This Also Read: JSF 2 Tutorials JSF Tutorials Introduction to JSF 1. Managed Bean IndexBean.java 2. The views login.xhtml welcome.xhtml expensesView.xhtml 3. Faces Configuration File faces-config.xml […]

JSF 2 Wildcard Navigation Rule Example

JSF-Thumbnail

In JSF you can use wildcard in the from-view-id element of a navigation rule, that is the rule applies to all pages that start with the prefix /somePrefix. Only a single (*) is allowed, and it must be at the end of the ID string. If there are multiple matching wildcard rules, the longest match is taken. The using of […]

JSF 2 Redirect Navigation Example

JSF-Thumbnail

You can configure the JSF configuration to redirect to a new view. Then the JSF implementation sends an HTTP redirect to the client. The redirect response tells the client which URL to use for the next page. The client then makes a GET request to that URL. Redirecting could be very slow some times because another round trip […]

JSF 2 Conditional Navigation Example

JSF-Thumbnail

As of JSF 2.0, you can supply an if element that activates a navigation case only when the condition is fulfilled. You can configure the condition in the faces configuration file itself to redirect to different views depends on the various conditions. This tutorial highlights the benefits of using the conditional navigation with simple example. Also […]

JSF 2 Navigation using From Action Example

JSF-Thumbnail

You’ve already seen the navigation using  Dynamic Navigation – Action Outcome, but as you’ve noted the using of navigation-case element within a faces-config.xml the from-outcome is provided. The navigation-case element is more complex that we previously discussed, In addition to the from-outcome element, there is also from-action element. That flexibility can be useful if you have two […]

JSF 2 Dynamic Navigation using From Outcome Example

JSF-Thumbnail

In most web applications navigation isn’t static, the page flow doesn’t just depend on which button you click but also on the inputs that you provide. For example, submitting a login page may have two outcomes: success or failure. The outcome depends on a computation-namely, whether the username and password are legitimate. To implement dynamic navigation, […]

JSF 2 Static Navigation Example

JSF-Thumbnail

The navigation is one of the powerful points that makes the development of the web application more easier. From the day one JSF provides a built-in navigation mechanism that allow moving from one view to another. The navigation handler is responsible for selecting the next JSF view, when the user has posted the form back […]