已采納回答 / 慕少4801248
dao層判空是因為它要返回的是一個Employee對象,而那個東西查出來的是list,需要把list轉(zhuǎn)換成Employee對象,如果list沒有東西,list.get()方法會報空指針。而Action判斷是為了控制頁面跳轉(zhuǎn)
2016-11-15
最新回答 / 灰灰也很可愛3561554
public String edit(){ ? ?Integer id =Integer.parseInt(org.apache.struts2.ServletActionContext.getRequest().getParameter("id")); department = departmentService.findById(id); return "editSuccess"; }把獲取id值得方法修改一下
2016-11-07
最新回答 / 你莊哥哥
肯定是因為你就只查到一條數(shù)據(jù),可能是你的數(shù)據(jù)庫里只有一條數(shù)據(jù),也可能是你的獲取數(shù)據(jù)集合的邏輯有錯
2016-11-04
已采納回答 / 就是要戰(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