-2
 <f:actionListener binding="#{clController.getTotal((clController.year))}" />

我尝试调用 clController.getTotal((clController.year)) 函数,但我认为有问题。

为什么 ?我如何使用 actionListener 调用函数

我把这个actionListener

<h:commandButton type="submit"  action="#{clController.getPaymentByMonth(clController.year)}"  id="stateInfo"  value="Show Monthly "  >

                            </h:commandButton>

这之间

May 1, 2013 4:27:42 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SEVERE: Error Rendering View[/customerPaymentPlan.xhtml]
javax.faces.FacesException: javax.el.ELException: /customerPaymentPlan.xhtml @84,220 onclick="#{clController.getTotal((clController.year))}": Unable to find method [getTotal] with [1] parameters
    at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2350)
    at com.sun.faces.renderkit.RenderKitUtils.renderOnclick(RenderKitUtils.java:442)
    at com.sun.faces.renderkit.html_basic.ButtonRenderer.encodeBegin(ButtonRenderer.java:166)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
4

1 回答 1

0

属性的值binding必须是实现ActionListener接口的对象,而不是方法调用。

所以你会有:

<f:actionListener binding="#{clController.totalListener}" />

并且totalListener必须实现上述接口。

调用该方法的另一种可能性是这样的:

<h:commandButton type="submit" action="#{clController.getPaymentByMonth(clController.year)}" actionListener="#{clController.getTotal(clController.year)}" id="stateInfo" value="Show Monthly " />

- 所以不使用 f:actionListener 标签

于 2013-05-01T13:40:56.860 回答