不起作用" /> Primefaces <p:ajax update="@all" /> 不起作用

Primefaces 不起作用

2024-01-03

我在使用 p:ajax 更新属性元素时遇到问题。当我在代码中使用时<p:ajax update="@all" />然后我得到javax.el.PropertyNotFoundException。当我使用<f:ajax render="@all" />我什么也没有得到。我认为这些标签几乎相同。谁能解释发生了什么?

我正在使用 mojjara 实现、primefaces 3.5 和 Liferay jsf portlet 桥。

堆栈跟踪示例:

引起原因: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)

两个按钮:

<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 并没有按照设计实现它.

为了解决这个问题,我所做的就是依靠 JavaScript 的页面刷新。只需将其放入oncomplete按钮的属性。

oncomplete="window.location.replace(window.location.href);"

我相信如果您仍然遇到问题,这应该可以解决您的问题,或者留在这里供将来参考。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Primefaces 不起作用 的相关文章

随机推荐