jsf - Conditionally including a Facelet file via -
jsf - Conditionally including a Facelet file via <ui:include> -
i have 2 facelets files (index.xhtml , report.xhtml). utilize richfaces <ui:include src="report.xhtml"/>
load study index. works fine. when seek show study on conditions, fail! not work this:
<ui:include src="report.xhtml" rendered="#{indexservice.contentname == 'report'}"/>
.
the rendered attribute of ui:include not seem work.
how can load report.xhtml index.xhtml on conditions? error in code?
edit:
half of works now. changing facelet file works conditions. functionality of loaded facelet not work properly. why that? problem in code?
based on suggestions have this:
<h:form> <h:panelgrid> <a4j:commandlink value="home" render="contentpanel" action="#{indexservice.setcontentname('home')}"/> <a4j:commandlink value="report" render="contentpanel" action="#{indexservice.setcontentname('report')}"/> </h:panelgrid> </h:form> <a4j:outputpanel id="contentpanel"> <ui:fragment rendered="#{indexservice.contentname eq 'report'}"> <ui:include src="report.xhtml" /> </ui:fragment> </a4j:outputpanel>
edit 2:
this study facelet. if utilize without status functionality of study facelet works perfectly, if load using status posted in edit 1, buttons of <rich:panelmenuitem .../>
don't work anymore , <h:outputtext escape="false" value="#{reportservice.content}"/>
not load content. thought why?
edit 3:
changed <rich:panel header="report">...</rich:panel>
, behaviour still unchanged.
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <ui:composition> <h:outputstylesheet> .placesmenu { width: 200px; vertical-align: top; } .contentplace { vertical-align: top; } </h:outputstylesheet> <h:panelgrid columns="2" width="100%" columnclasses="placesmenu, contentplace"> <rich:panel header="places"> <h:form> <rich:panelmenu style="width: 170px"> <a4j:repeat value="#{reportservice.menuitems}" var="menuitem" id="repeat_layer1"> <rich:panelmenugroup label="#{menuitem.label}"> <a4j:repeat value="#{menuitem.submenuitemlist}" var="submenuitem" id="repeat_layer2"> <rich:panelmenuitem label="#{submenuitem.label}" render="reportpanel" onbeforedomupdate="#{reportservice.setid(submenuitem.id)}"/> </a4j:repeat> </rich:panelmenugroup> </a4j:repeat> </rich:panelmenu> </h:form> </rich:panel> <rich:panel header="report"> <h:outputtext escape="false" value="#{reportservice.content}" id="reportpanel"/> </rich:panel> </h:panelgrid> </ui:composition> </html>
try surround ui:include tag ui:fragment follows :-
<ui:fragment rendered="#{indexservice.contentname eq 'report'}"> <ui:include src="report.xhtml" /> </ui:fragment>
jsf jsf-2 richfaces facelets
Comments
Post a Comment