0
votes

I have a p:dialog where dynamic is set to true. In the command button, I am calling it to be displayed such <p:commandButton ajax="true" actionListener="#{bean.setCurrentElement(element)}" oncomplete="myDialog.show" update=":myForm:myDialogId"/>. Inside the dialog, I have a <p:selectOneMenu value="#{bean.currentElement.someId}"`

When I click on the command button, the code blows up since the bean.currentElement is accessed before the action listener is complete there by rendering it null. When I use <h:outputText>, dialog displays properly. My dialog is defined as <p:dialog header="Bla" widgetVar="myDialog" modal="true" id="myDialogId" dynamic="true">

The bean is viewScoped. Any ideas why the dialog is rendered before the action Listener method is called. ?

1
I think you are right but I get this exception javax.faces.component.UpdateModelException: javax.el.PropertyNotFoundException: /pages/dialog/myDialog.xhtml @58,73 value="#{bean.currentElement.someId}": Target Unreachable, 'null' returned nullEnder Wiggin
I don't think I can provide a SSCSE since it is pretty convoluted and somebody else code that I am trying to work on. Is there anything I can do to determine what's causing it be reconstructed for every request.Ender Wiggin

1 Answers

0
votes

I unfortunately did not have time to figure out what was going on. What I did was a hack if it can be called that. I created the class during view initialization. The dummy object made sure the get did not blow up and the action listener set it to proper object and then get fired again to get the correct value.

I will try to check and see why this is happening and post my results.