本篇文章不会系统的讲解知识也不会深入讲,只会说明一个很具体的问题,属于随手记录型。
如何用 ModelAndView 进行重定向
//返回一个ModelAndView
public ModelAndView updateInfo(Info info) {
ModelAndView modelAndView = new ModelAndView();
//更新
infoService.updateSelect(info);
// 设置视图,到更新成功页面
modelAndView.setViewName("redirect:/xxxx/Update.jsp");
return modelAndView;
}
//或者 参数里来一个
public ModelAndView updateInfo(ModelAndView modelAndView) {
// 设置视图,到更新成功页面
modelAndView.setViewName("redirect:/xxxx/Update.jsp");
}
只是一种(其他还有很多)
SSM工程启动报错:foreach的集合,不是var而是item
Ignoring bean creation exception on FactoryBean type check:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'certificateArticleMapper' defined in file [xxx...\dao\CertificateArticleMapper.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory': :
Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-datasource.xml]:
Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [xxx...m\oracle\entity\InfoMapper.xml]';
nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.
Cause: org.xml.sax.SAXParseException; lineNumber: 616; columnNumber: 74; 必须为元素类型 "foreach" 声明属性 "var"。; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Program Files (x86)\apache-tomcat-8.5.38\wtpwebapps\o2o\WEB-INF\classes\com\oracle\entity\InfoMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 616; columnNumber: 74; 必须为元素类型 "foreach" 声明属性 "var"。
InfoMapper.xml 里面mybatis的 foreach 写错 了,,不是var ,是 item。