Я получаю ошибки при добавлении этого ActionListener
У меня есть код ниже:
<h:commandButton type="submit" action="#{clController.getPaymentByMonth(clController.type)}" id="stateInfo" value="Show Monthly " >
<f:actionListener binding="#{clController.getTotal(clController.type)}" />
</h:commandButton>
Когда я добавлю <f:actionListener binding="
это дает следующие ошибки:
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
at com.sun.faces.facelets.tag.jsf.core.ActionListenerHandler$LazyActionListener.processAction(ActionListenerHandler.java:112)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
Это моя функция getTotal:
List<CustomerPayment> total = null;
try {
org.hibernate.Transaction tx = session.beginTransaction();
Query q = session.createQuery("SELECT SUM(amount) from CustomerPayment where DATE like '%"+year+"' GROUP BY type");
total = (List<CustomerPayment>) q.list();
} catch (Exception e) {
e.printStackTrace();
}
return totalDataTable = new ListDataModel(total);
В чем может быть проблема?
1 ответ
Проблема в ценности actionListener
"s binding
атрибут - он должен указывать на объект, реализующий ActionListener
Интерфейс - не вызов метода, как в вашем случае.
Из спецификации JSF:
Выражение привязки значения, которое оценивает объект, который реализует javax.faces.event.ActionListener.