Announcement Announcement Module
Collapse
No announcement yet.
Redirect to j_spring_security_logout from a Controller in Spring Security 3.1.1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirect to j_spring_security_logout from a Controller in Spring Security 3.1.1

    I have a jsp with a form that has 2 buttons "save" and "close", both call the same method and if I detect that the close button was pressed I should then redirect to Spring Security logout... but when I do that I get a 404 error in tomcat:

    Code:
    Estado HTTP 404 - /SICCO/WEB-INF/jsp/j_spring_security_logout.jsp
    
    type Informe de estado
    
    mensaje /MyWebapp/WEB-INF/jsp/j_spring_security_logout.jsp
    
    descripción El recurso requerido (/MyWebapp/WEB-INF/jsp/j_spring_security_logout.jsp) no está disponible.
    the piece of code is:

    Code:
    @RequestMapping("guardar") 
    public String guardar(Model model, @ModelAttribute("precol")Precolonoscopia precol, HttpServletRequest request) {
    
        if (WebUtils.hasSubmitParameter(request, "cerrar")) {
            return "j_spring_security_logout";
        }
            //things...
        return "/other/page";
    }
    I've also tried with

    return "/j_spring_security_logout"

    but I got the same error. And also returning ModelAndView instead of String... I got the same result.

    I have another jsp that calls directly to Spring Security Logout:

    Code:
    < c:url value="/j_spring_security_logout" var="url" / >
    < form action="${url}" method="post">
    * * < button name="cerrar">< s:message code="myapp.cerrar"/ >< /button>
    < /form>
    And this works as expected...

    What am I doing wrong?

  • #2
    I had the answer just in front of me! I asked "how to redirect"... and that was the key...

    Code:
    return "redirect:/j_spring_security_logout"
    works

    Comment

    Working...
    X