p:dialog in ui:composition doesn't resolve composition parameter

sws Source

For recurring usecase of data maintenance forms, i'm trying to use JSF 2.2 templating and compositioning.

Main template.xhtml defines 'action' and 'content':

<h:body>
<f:view> 
<p:ajaxStatus onstart="PF('statusDialog').show()" onsuccess="PF('statusDialog').hide()" />

<p:dialog widgetVar="statusDialog" modal="true" draggable="false" closable="false" resizable="false" showHeader="false">
<p:graphicImage name="img/ajaxloadingbar.gif" />
</p:dialog>
<h:form id="templateForm">
...
    <div>
        <ui:insert name="action" />
    </div>
    <div>
        <ui:insert name="content" />
    </div>
....
</h:form>
</f:view>
</h:body>
</html>

Form template defines the composition (templateForm.xhtml):

<ui:composition >

<cc:interface>
    <cc:attribute name="bean" type="de.my.commons.jsf.GenericEditAction"/>
    <cc:attribute name="saveEnabled" default="true" />
    <cc:attribute name="deleteEnabled" default="false" />
</cc:interface>

<cc:implementation>
    <ui:decorate template="/WEB-INF/template.xhtml">
    <ui:define name="content">
        <ui:insert name="formContent"/>
        <dialogs:dismissDialog backTo="#{cc.attrs.bean.backTo}" />
    </ui:define>

    <ui:define name="action">
        <p:commandButton 
            id="button1" 
            value="#{apptext['speichern']}" 
            styleClass="btn btn-default"
            rendered="#{cc.attrs.saveEnabled}"
            action="#{cc.attrs.bean.save()}"
            ajax="false"/>
        ....    
        <ui:insert name="additionalAction" />
        ....
    </ui:define>
</ui:decorate>
</cc:implementation>
</ui:composition>

So I can use this in dataEditForm.xhtml, which is also a composition:

<ui:composition>
<ui:decorate template="/WEB-INF/templateForm.xhtml">

    <ui:define name="formContent">
        ...
        ...
    </ui:define>
</ui:decorate>
</ui:composition>

in the following style (data.xhtml):

<forms:dataForm 
    contentTitle="Data #{dataEditActions.entity.id}"
    id="svForm"
    bean="#{dataEditActions}"
    saveEnabled="true"
    deleteEnabled="true"/>

I put a bean as parameter into this and everything works fine, except the dismissDialog in templateForm. JSF always tells me that 'backTo' is null, leading to a

Could not resolve NavigationCase for outcome:

If I position the dialog in dataEditForm.xhtml, it run's perfectly, breaking the intention not to put the same dialog in 20+ forms.

What am I doing wrong?

templatesjsfprimefacesmodal-dialog

Answers

comments powered by Disqus