已采纳回答 / 慕少4801248
dao层判空是因为它要返回的是一个Employee对象,而那个东西查出来的是list,需要把list转换成Employee对象,如果list没有东西,list.get()方法会报空指针。而Action判断是为了控制页面跳转
2016-11-15
已采纳回答 / 就是要战逗
Hibernate4 的话不用继承那个 ..Support 类,也不需要这个HibernateTemplate ,注入一个sessionFactory, 然后这个sessionFactory.getCurrentSession,之后按Hibernate正常处理 。对了,需要在application里面 hibernate设置那里 加上 这个: <prop key="hibernate.current_session_context_class">org.springframework.o...
2016-11-04
最新回答 / viwq
<filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </filter-class> <init-param> <param...
2016-10-06
最新回答 / 雪雨孤岛
还是得靠自己,laozi告诉你们正解。Employee中的Department成员变量,在使用ModelDriven之前,必须要Department department = new Department();因为没有实例化,所以无法对department.did赋值。解决方法:在Employee中添加构造方法public Employee( department = new Department();)就是在用之前实例化,就可以了。老师挖的坑。。
2016-09-29
已采纳回答 / 慕粉3727206
要在struts.xml配置文件中package加入strict-method-invocation="false"的属性,即<package name="ssh" extends="struts-default" namespace="/" strict-method-invocation="false"></package>。
2016-08-31
最新回答 / qq_很现实_0
@Override public Department getModel() { // TODO Auto-generated method stub return department; }getModel();你返回的是不是null?
2016-08-30