简体   繁体   中英

How does Spring 3 map the form-post in this jsp?

At line 17 of login.jsp , there is the following line of code:

<form action="/login/submit" method="post">

What I can't determine is where Spring submits this form to.

In the corresponding LoginController.java , I don't see any mapping to the URL ' /login/submit ' such as this:

@RequestMapping(value = "/login/submit", method = RequestMethod.POST)

So how does Spring 3 know what to do with this form action?

UPDATE:

Found this here :

<form-login login-page="/login" login-processing-url="/login/submit" authentication-failure-url="/login/error" />

Spring 3 only "knows" what you tell it to, either through your XML configuration or annotations.

Your question is really "Where do I have /login/submit mapped to a controller?", and without your code, we cannot answer any of this.

Are you using Spring Security, which may have a login-form mapped to this URL? If so, examine your Spring Security context XML file.

Otherwise, turn up DEBUG logging within Spring and upon server startup it will map out each URL that is mapped to each controller.

So the login processing URL takes care of handling this form POST. If you look further in the security context file (most likely the file where you found the form-login element) you should see an authentication manager and a user details service which will tell you how Spring knows which credentials are authentic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM