Results 1 to 2 of 2

Thread: Redirect to j_spring_security_logout from a Controller in Spring Security 3.1.1

  1. #1
    Join Date
    Jul 2008
    Posts
    19

    Default 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. #2
    Join Date
    Jul 2008
    Posts
    19

    Default

    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •