以下方法在main里测试过正常,但在action里 就出现空指针的错误 public ActionForward allcard (ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response){
List pagedatabase = this.cardTypeDAO.createQuery("from CardType"); Dao里面的方法 public List createQuery(String hql){
List list= null;
try {
Query query=getSession().createQuery(hql);
list=query.list();
} catch (Exception e) {
System.out.println("异常");
e.printStackTrace();
}finally{
Query query=getSession().createQuery(hql);
list=query.list();
}
return list;
}就搞不懂了,出现空指针异常,错误的根源指向Dao方法的 list=query.list();
HttpServletRequest request,HttpServletResponse response){
List pagedatabase = this.cardTypeDAO.createQuery("from CardType"); Dao里面的方法 public List createQuery(String hql){
List list= null;
try {
Query query=getSession().createQuery(hql);
list=query.list();
} catch (Exception e) {
System.out.println("异常");
e.printStackTrace();
}finally{
Query query=getSession().createQuery(hql);
list=query.list();
}
return list;
}就搞不懂了,出现空指针异常,错误的根源指向Dao方法的 list=query.list();
解决方案 »
- 怎样将每学期的第几周星期几几点转化为日期显示
- JSP如何控制访问人数?
- 百分求助jstl连接两个数据库的问题
- 在jsp中怎样实现播放视频呢?
- 高手帮帮忙啊,明天要交作业。一个分页显示JSP程序编译出错。急!!!!!
- <%@ page contentType="text/html; charset=gb2312" %>能不能写在某一个文件中呀?
- JSP毕业设计的物业管理系统,请大家给点意见,谢谢
- 如何js将数组转化为json数组,然后后台如何解析?
- 请问字符串怎么填充EasyUI的树呢?
- 各位大神过来看看,关于linux 下tomcat 连接问题
- 关于hibernate,有没有根据表结构自动生成【映射文件】和【持久化类】的工具,myeclipse可以吗?
- 求struts 的问题
可能是你的action里没有成功注入dao接口,仔细检查一下