1

how can I hide a facelets component I am including in a template?

in my template.xhtml:

<h:form id="mainForm">    
<div style="overflow:hidden; width:1020px; height:565px; overflow-x:hidden; " >
        <ui:include src="menuSharepoint.xhtml" styleClass="hide" />     
    <ui:insert name="body">Default Body</ui:insert>
</div>
<div style="width: 1000px; height: 6px; float: left"></div>
</h:form>

I'm trying to hide the ui:include menuSharepoint.xhtml.

user840930
  • 5,214
  • 21
  • 65
  • 94

1 Answers1

2

You can surround it with a component with a controllable rendered property:

<h:panelGroup rendered="false">
  <ui:include src="menuSharepoint.xhtml"/>
</h:panelGroup>

Also rendered can be set as an EL expression like rendered="#{myBean.menuVisible}".

mrembisz
  • 12,722
  • 7
  • 36
  • 32
  • I tried it but get an error message : The element type h:form must be terminated by the matching end-tag "". Strange message since the end tag is there. – user840930 Jun 13 '12 at 12:14
  • There must be something wrong with your xml, analyze it closely. By the way, styleClass is not a valid attribute for ui:include. Also have a look at menuSharepoint.xhtml. – mrembisz Jun 13 '12 at 12:41
  • 1
    Remove the `/` from the first tag in this answer. – BalusC Jun 13 '12 at 13:01