本来是在页面中调用action中的一个方法,可是调试断点明明进去了,hql语句怎么也不能执行。代码如下
<s:property value="%{getSubjectOptions(#subid)}"/>
这个方法必须要有个返回值!
后台的方法是这样的
String hql="select count(vo) from VoteOption vo where vo.voteSubject.vsId=?";
Query query=null;
query=HibernateSessionFactory.getSession().createQuery(hql);
query.setInteger(0, subjectId);
int r= ((Long)query.uniqueResult()).intValue();
return r;
每次到createQuery的时候就直接跳到ognlruntime.class那个类了,也不报错!
这个问题纠结了一天,后来经人指导才发现如果我添加了myeclipse里面的struts2和Hibernate这个类库里都有个
antlr-xxx.jar这个包,会有重复!
解决方法:window---preferences--MyEclipse--Project Capabilities---Struts2,选择antlr这个jar包,点击Remove就行了!