Custom Error Page Not Decorated by Sitemesh in Spring Security Application

痴心易碎 提交于 2019-12-06 13:18:42

This seems to be a Sitemesh bug (see: http://forum.spring.io/forum/spring-projects/security/37742-sitemesh-decoration-problem) that can be solved via a redirect. For various reasons I did not want to do the redirect from within the JSP page, so I changed my controller:

@RequestMapping("error")
    public String displayErrorPage(
    @RequestParam(value = "code", defaultValue = "0") int code,
    RedirectAttributes redirectAttributes, final HttpServletRequest request,
    Principal principal) {
    // ...
    redirectAttributes.addFlashAttribute("myAttribute", myAttribute);
    return "redirect:/displayError";
}

@RequestMapping("displayError")
public String displayError() {
    return "errorPage";
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!