已采納回答 / 慕少4801248
dao層判空是因為它要返回的是一個Employee對象,而那個東西查出來的是list,需要把list轉(zhuǎn)換成Employee對象,如果list沒有東西,list.get()方法會報空指針。而Action判斷是為了控制頁面跳轉(zhuǎn)
2016-11-15
已采納回答 / 就是要戰(zhàn)逗
Hibernate4 的話不用繼承那個 ?..Support 類,也不需要這個HibernateTemplate ,注入一個sessionFactory, 然后這個sessionFactory.getCurrentSession,之后按Hibernate正常處理 。對了,需要在application里面 hibernate設(shè)置那里 ? 加上 這個:?<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中添加構(gòu)造方法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_很現(xiàn)實_0
@Override public Department getModel() { // TODO Auto-generated method stub return department; }getModel();你返回的是不是null?
2016-08-30