[jsf] Conditionally displaying JSF components

First, I am new to Java EE, came from a strong ASP .NET development background. I have gone through the net, and I might miss this but it seems like there is no simple and straight-to-the-point tutorials on how I could connect backing bean class to a JSF components.

A good example is like this, currently I am trying to create a JSF page where there is a set of links as menu bar and a set of forms. What I am planning to do is, when clicking a link, a particular form will be rendered.

In ASP.NET, I could easily retrieve the element and then set the attribute to be displayable. I am wondering if there is easy way (heck, even any way) to do this in JSF.

The forms is already in the page, it is just a matter of setting the "render" attribute to true when I click a particular link.

This question is related to jsf components conditional-rendering

The answer is


In addition to previous post you can have

<h:form rendered="#{!bean.boolvalue}" />
<h:form rendered="#{bean.textvalue == 'value'}" />

Jsf 2.0