< bean id =" signinDAO"类=" com.socialshop.authentication.dao.SigninDAOImpl"> < property name =" sessionFactory" REF =" mySessionFactory这个" /> < /豆腐>
public interface SigninDAO{
public List<DataObject> getList();
}
public class SigninDAOImpl extends HibernateDaoSupport {
public List<T> getList() {
return (getHibernateTemplate().find("from " + dataClass.getName() + " x"));
}
}
@Controller
@RequestMapping("/signin.html")
public class Signin {
private SigninDAO signinDAO;
Signin(){
}
public void setSigninDAO(SigninDAO signinDAO) {
this.signinDAO = signinDAO;
}
@RequestMapping(method=RequestMethod.POST)
public String processSubmit(@ModelAttribute("signinRequest") SigninRequest signinRequest,
BindingResult result, SessionStatus status) {
List<Merchant> merchant = signinDAO.getList();
return "index";
}
}
当我的登录表单被发布时,调用了processSubmit方法,我在这里得到空指针Exception List<Merchant> merchant = signinDAO.getList();
看起来setSigninDAO()
方法未映射此请求?我该如何映射?
在这种情况下如何使用multiactioncontroller?
答案 0 :(得分:2)
您需要使用@Autowired
注释您的依赖项设置器方法:
@Autowired
public void setSigninDAO(SigninDAO signinDAO) {
this.signinDAO = signinDAO;
}
另见: