Primefaces< p:ajax update =“" @ all" />不起作用 [英] Primefaces <p:ajax update="@all" /> doesn't work
问题描述
使用p:ajax更新属性元素时出现问题.当我在代码<p:ajax update="@all" />
中使用时,我会得到javax.el.PropertyNotFoundException
.当我使用<f:ajax render="@all" />
时,我什么也没得到.我虽然那thouse标签几乎是相同的.谁能解释发生了什么事?
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?
我正在使用mojjara实现,primefaces 3.5和Liferay jsf portlet桥.
I am using mojjara implementation, primefaces 3.5 and Liferay jsf portlet bridge.
stacktrace的示例:
Example of stacktrace:
原因:javax.el.PropertyNotFoundException:/pages/views/personForm.xhtml @ 95,99 value =#{personManagementBean.item.contact.phoneNumber}":目标无法访问,'null'返回null 在com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100) 在org.primefaces.renderkit.InputRenderer.findImplicitConverter(InputRenderer.java:170) 在org.primefaces.renderkit.InputRenderer.findConverter(InputRenderer.java:190) 在org.primefaces.renderkit.InputRenderer.getConvertedValue(InputRenderer.java:196) 在javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030) 在javax.faces.component.UIInput.validate(UIInput.java:960) 在javax.faces.component.UIInput.executeValidate(UIInput.java:1233) 在javax.faces.component.UIInput.processValidators(UIInput.java:698) 在javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) 在javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) 在javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) 在javax.faces.component.UIForm.processValidators(UIForm.java:253) 在javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
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)
两个按钮:
<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>
推荐答案
OptimusPrime(Primefaces的主要开发者)指出update="@all"
是一个坏主意,primefaces并非通过设计实现
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.
为了解决该问题,我要做的就是依靠javascript刷新页面.只需将其放在按钮的oncomplete
属性中即可.
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.
这篇关于Primefaces< p:ajax update =“" @ all" />不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!