你的代码是怎么写的?
SimpleFormController 只在下面方法中作了判断:
protected ModelAndView onSubmit(Object command, BindException errors) throws Exception {
ModelAndView mv = onSubmit(command);
if (mv != null) {
// simplest onSubmit version implemented in custom subclass
return mv;
}
else {
// default behavior: render success view
if (getSuccessView() == null) {
throw new ServletException("successView isn't set");
}
return new ModelAndView(getSuccessView(), errors.getModel());
}
}并由
protected ModelAndView onSubmit(
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws Exception { return onSubmit(command, errors);
}
调用。你覆写任何一个onsubmit()都不会出现你的问题。怀疑你LoginAction中的onsubmit参数和我帖出来那2个方法的不一致.另外,第一个onsubmit()方法明显是为了那种Controller中不含业务逻辑,仅仅只为了转向到某view准备的。
SimpleFormController 只在下面方法中作了判断:
protected ModelAndView onSubmit(Object command, BindException errors) throws Exception {
ModelAndView mv = onSubmit(command);
if (mv != null) {
// simplest onSubmit version implemented in custom subclass
return mv;
}
else {
// default behavior: render success view
if (getSuccessView() == null) {
throw new ServletException("successView isn't set");
}
return new ModelAndView(getSuccessView(), errors.getModel());
}
}并由
protected ModelAndView onSubmit(
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws Exception { return onSubmit(command, errors);
}
调用。你覆写任何一个onsubmit()都不会出现你的问题。怀疑你LoginAction中的onsubmit参数和我帖出来那2个方法的不一致.另外,第一个onsubmit()方法明显是为了那种Controller中不含业务逻辑,仅仅只为了转向到某view准备的。
解决方案 »
- 配置spring MVC的时候,启动报异常?
- [求教]返回在两字符串中第一个相同的子串(大于1个字符),并将子串输出
- 查询大数据时出现org.hibernate.exception.GenericJDBCException: Cannot open connection
- 高人解答。。批量生成
- 数据库已连上,在从表里查询数据时,遇到问题
- struts的问题?
- 问个struts的简单问题
- 请问org.hibernate.proxy.SerializableProxy这是什么错误?
- TextArea
- 小弟不才,请教各位DAO问题?
- 简单问题求助
- installshield6.2能不能做java的安装程序?
(Object cmd,BindException ex)throws Exception{
ModelAndView mav=null;
LoginInfo logininfo=(LoginInfo)cmd;
if (login(logininfo)==0){
HashMap result_hasp=new HashMap();
result_hasp.put("logininfo", logininfo);
List msgList=new LinkedList();
msgList.add("MSG111111");
msgList.add("MSG222222");
msgList.add("MSG333333");
result_hasp.put("messages", msgList);
mav=new ModelAndView(this.getSuccessView(),result_hasp);
}else{
mav=new ModelAndView(this.getFail_view());
}
return mav;
}
protected ModelAndView onSubmit
(HttpServletRequest request,HttpServletResponse response,Object cmd,BindException ex)throws Exception{
ModelAndView mav=null;
LoginInfo logininfo=(LoginInfo)cmd;
if (login(logininfo)==0){
HashMap result_hasp=new HashMap();
result_hasp.put("logininfo", logininfo);
List msgList=new LinkedList();
msgList.add("MSG111111");
msgList.add("MSG222222");
msgList.add("MSG333333");
result_hasp.put("messages", msgList);
mav=new ModelAndView(this.getSuccessView(),result_hasp);
}else{
mav=new ModelAndView(this.getFail_view());
}
return mav;
}