Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to not render whole block in JSF?

Tags:

jsf

primefaces

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!

like image 609
Kai Avatar asked Dec 06 '11 10:12

Kai


2 Answers

<h:panelGroup>

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

Otherwise, you have a <span> tag.

like image 159
BachT Avatar answered Nov 11 '22 01:11

BachT


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

like image 38
Daniel Avatar answered Nov 11 '22 01:11

Daniel