/WEB-INF/layouts/layouts.xml
/WEB-INF/views/**/views.xml
加上jar包 :
com.fasterxml.jackson.core
jackson-core
2.1.0
com.fasterxml.jackson.core
jackson-databind
2.1.0
com.fasterxml.jackson.core
jackson-annotations
2.1.0
当类中含有类的时候,json会出错:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.domain.User.articles, could not initialize proxy - no Session 需要将User中的Article忽略json:
@JsonIgnore
private Article article;
@Controller
@RequestMapping(value="trash/{id}")
public String trash(HttpServletRequest request, HttpServletResponse resposne, ModelMap modelMap,@PathVariable("id") Integer id, Article article){
articleService.trashArticleById(id);
return null;
}
json返回null视图