问题
I've got a problem with using p:ajax update atribute element. When I use in my code <p:ajax update="@all" />
then I am getting javax.el.PropertyNotFoundException
. When I use <f:ajax render="@all" />
I don't get any. I though that thouse tags are nearly same. Can anyone explain whats happening?
I am using mojjara implementation, primefaces 3.5 and Liferay jsf portlet bridge.
Example of stacktrace:
Caused by: javax.el.PropertyNotFoundException: /pages/views/personForm.xhtml @95,99 value="#{personManagementBean.item.contact.phoneNumber}": Target Unreachable, 'null' returned null at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100) at org.primefaces.renderkit.InputRenderer.findImplicitConverter(InputRenderer.java:170) at org.primefaces.renderkit.InputRenderer.findConverter(InputRenderer.java:190) at org.primefaces.renderkit.InputRenderer.getConvertedValue(InputRenderer.java:196) at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030) at javax.faces.component.UIInput.validate(UIInput.java:960) at javax.faces.component.UIInput.executeValidate(UIInput.java:1233) at javax.faces.component.UIInput.processValidators(UIInput.java:698) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) at javax.faces.component.UIForm.processValidators(UIForm.java:253) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
Two buttons:
<p:commandButton value="not working" action="#{enrollmentManagementBean.cancelEnrollment}">
<p:ajax update="@all" />
</p:commandButton>
<h:commandButton value="working" action="#{enrollmentManagementBean.cancelEnrollment}">
<f:ajax render="@all" />
</h:commandButton>
回答1:
OptimusPrime (main developer of Primefaces) states that update="@all"
is a bad idea and primefaces does not implement it by design link to forum post.
What I do in order to get around the problem is rely on page refresh from javascript. Just put it in the oncomplete
attribute of the button.
oncomplete="window.location.replace(window.location.href);"
I believe this should solve your problem if you still have it, or be here for future reference.
来源:https://stackoverflow.com/questions/16352372/primefaces-pajax-update-all-doesnt-work