1

I have following scenario:

Page1.xhtml

<p:datatable>
<p:column>
<p:commandLink value="#{tableRow.businessObject.xyz"
                    action="#{view.backingBean.view}" 
                     partialSubmit="true" update="PageId2"
                    oncomplete="PF('PageVar2').show()">
                    <f:setPropertyActionListener value="#{tableRow}"
                        target="#{view.backingBean.selectedTableRow}" />
</p:commandLink>

<p:dialog modal="true" id="PageId2" widgetVar="PageVar2" 
                    closable="true" minimizable="true" style="background-color: white"      
                    header="Page2"
                    height="600" width="450" appendTo="@(body)">
                    <h:form>
                   <ui:include src="/.../Page2.xhtml"/>

    <p:commandButton value="close" onclick="PF('PageVar2').hide()" partialSubmit="true"/>                                    
                    </h:form>
</p:dialog>

</p:colum>
.
.

Page2.xhtml

.
.
<ui:composition>
   <ui:param name="backingBean" value="#{sessionBean.currentView['Page2BackingBean']}" />

<p:datatable>
<p:column>
 <h:outputLabel for="abc" value="ABC"/>
  <h:outputText id="abc" value="#{view.backingBean.businessObject.abc}" />
</p:column>
</p:datatable>
</ui:composition>
.
.

While on action="#{view.backingBean.view}, it shall call generalised class view.java which will get the selected table row and create View page for Page2. But if I click on the command link before loading the Page1.xhtml, I am getting error at browser as:javax.el.PropertyNotFoundException: Could not find property businessObject in Page1.xhtml.

It looks like while loading the full page, it is trying to load the page written inside ui:include tag i.e. Page2.xhtml and it is not able to find current BusinessObject while screen loading.

How to resolve this issue??

A.Alessio
  • 321
  • 2
  • 15
Nazneen Mulani
  • 93
  • 1
  • 2
  • 9
  • 1
    'Begging' (_"@BalusC could you plz help me on this"_) is not a good thing to do on stackoverflow. If you want his explicit help, find the company he works for and hire him – Kukeltje Mar 19 '20 at 10:13

1 Answers1

0

I believe you need to pass the bean as a parameter to the Page2.xhtml. As is answered here: Passing the backing bean as a parameter to a Facelet include:

You can use <ui:param> for that. It needs to be nested in the <ui:include>.

<ui:include src="/.../Page2.xhtml"/>
    <ui:param name="Bean" value="#{YourBeanName}" />
</ui:include>
A.Alessio
  • 321
  • 2
  • 15