当我添加此ActionListener时出现错误 [英] I get errors when i add this ActionListener
本文介绍了当我添加此ActionListener时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码:
< h:commandButton type =submitaction =#{clController.getPaymentByMonth (clController.type)}id =stateInfovalue =显示每月>
< / h:commandButton>
当我添加< f:actionListener binding =
此它给出以下错误:
在com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression。的java:114)
。在com.sun.faces.facelets.tag.jsf.core.ActionListenerHandler $ LazyActionListener.processAction(ActionListenerHandler.java:112)
。在javax.faces.event.ActionEvent.processListener( ActionEvent.java:88)在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);
可能是什么问题?
解决方案
问题出在 actionListener
的绑定
属性的值上 - 它应指向一个实现 ActionListener
接口的对象 - 不是像你的情况那样调用方法。
JSF规范:
$ b
值绑定表达式,其值为实现javax.faces.event.ActionListener的对象。
I have below code:
<h:commandButton type="submit" action="#{clController.getPaymentByMonth(clController.type)}" id="stateInfo" value="Show Monthly " >
<f:actionListener binding="#{clController.getTotal(clController.type)}" />
</h:commandButton>
When i add <f:actionListener binding="
this it gives below errors:
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)
This my getTotal function:
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);
What might be the problem?
解决方案
The problem is in the value of actionListener
's binding
attribute - it should point to an object implementing the ActionListener
interface - not a method call as is in your case.
From the JSF spec:
Value binding expression that evaluates to an object that implements javax.faces.event.ActionListener.
这篇关于当我添加此ActionListener时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文