Conditional config.xhtml

Post Reply
synaptic
Posts: 11
Joined: 30 Jan 2019, 16:59

23 Jan 2021, 19:14

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.

mert.sincan
Posts: 4638
Joined: 29 Jun 2013, 12:38

29 Jan 2021, 02:11

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,

Post Reply

Return to “Sapphire - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest