jsfcomponentshidefaceletsuiinclude

hide component of facelet template ui:include ?


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.


Solution

  • 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}".