Search code examples
jsflayoutconditional-statementsfaceletsuiinclude

Conditional ui:include and preserve layout in JSF


is it possible in JSF facelets to do a conditional ui:include and preserve the layout of the parent (the including xhtml)?

Example: I have a form which has always some basic attributes rendered in a panelgrid with 4 columns (label, input, label input). Now I have some type specific form input elements. For each type specific form part I created a separate xhtml. For this the specific attributes have to be conditionally included after the basic attributes. Unfortunately the ui:include has no rendered attribute. So I have to wrap something around the ui:include. This unfortunately "overrides" my layout set by the including parent which defines 4 columns. I want to render the specific attributes in this 4 column panelGrid without starting a new layout element which is vanishing my layout. Is there a possibility in JSF to achieve this?

Regards Oliver


Solution

  • You could use a c:if statement wrapping the ui:include element to conditionally render it.