5
votes

Is there a JSF 2.1 component which lets me conditionally render (or not render) all its content? Something like

<h:component rendered="#{user.loggedIn}">

...a bunch of jsf components and HTML code...
...even more HTML code...

</h:component>

I am using PrimeFaces 3M4 as this may influence your answer!

2

2 Answers

9
votes
<h:panelGroup>

If you set attribute layout="block", you will have a <div> tag

Otherwise, you have a <span> tag.

2
votes

In general most of jsf components support the render attribute (never bumped in some that does not), container components like h:panelGrid or h:panelGroup supports the rendered attribute and if its set to false all its child will be hidden too

Same goes for the primefaces components ,and if not it probably a bug (i think there was an issue with tabview of primefaces)

Here's a link for primefaces user guide, you can find supported attributes of all primefaces components there User’s Guide for 3.0.M4