Page 1 of 1

Conditional config.xhtml

Posted: 23 Jan 2021, 19:14
by synaptic
How can I do the <ui:include src="./config.xhtml" /> to be conditional (preferred with JSF only, w/o JSTL)?

I've tried below, when myBean.edit boolean equal to true, no luck

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

<h:head />
<h:body>
    <h:panelGroup id="viewPanel1">
        <h:panelGroup id="tableRenderPanel2" rendered="#{myBean.edit}">    
            <ui:include src="./config.xhtml" />
        </h:panelGroup>                         
    </h:panelGroup>			
</h:body>
</html>
of course template.xhtml and config.xhtml are in the same path.

Re: Conditional config.xhtml

Posted: 29 Jan 2021, 02:11
by mert.sincan
Are you updating the panel element after you make the change in bean?

Also, you can try it with;

Code: Select all

<ui:fragment rendered="#{myBean.edit}">
    <ui:include src="./config.xhtml" />
</ui:fragment>

Note: Please update parent element after changing edit's value

Best Regards,