5

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!

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Kai
  • 207
  • 4
  • 10

2 Answers2

9
<h:panelGroup>

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

Otherwise, you have a <span> tag.

BachT
  • 1,058
  • 9
  • 17
2

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

Daniel
  • 36,833
  • 10
  • 119
  • 200
  • Thanks for your additional information. I already know the very well structured and complete PF manual but could not figure out what the simpliest way to (not) render a block of elements is, respectively what component is the best to accomplish this. – Kai Dec 06 '11 at 10:37