Primefaces <p:ajax update=“@all” /> doesn't work

流过昼夜 提交于 2019-12-22 01:32:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!