Announcement Announcement Module
Collapse
No announcement yet.
registration and login buttons in same form (JSP) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • registration and login buttons in same form (JSP)

    Is there any way to use two submit buttons in same form, one using the url "j_spring_security_check" and the other one calling a controller method?

    thanks in advance for your help!

  • #2
    You would need to override the requiresAuthentication method to return true when an http parameter is present and matches the URL:

    Code:
    protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) {
        return request.getParameter("login") != null && 
                super.requiresAuthentication(request,response);
    }
    Then your controller could act upon the same URL when the parameter registration is non null.

    Code:
    @RequestMapping(value="/j_spring_security_login",params="registration")
    public String register(...) {
       ...
    }
    Your HTML would then look something like this:

    Code:
    <form action="<c:url value="/j_spring_security_check"/>" method="POST">
        ...
        <input type="submit" name="login" value="Login"/>
        <input type="submit" name="registration" value="Registration"/>
    </form>

    Comment

    Working...
    X