Home > Back-end >  The controller RequestMapping (value="${adminPath}/login" corresponding to the two methods
The controller RequestMapping (value="${adminPath}/login" corresponding to the two methods

Time:10-16

The code is as follows:

@ Controller
Public class LoginController {

@ RequestMapping (value="{adminPath} https://bbs.csdn.net/topics/$/login")
Public String login (it request, HttpServletResponse response) throws IOException {
Return "modules/sys/login/sysLogin";
}

@ RequestMapping (value="https://bbs.csdn.net/topics/${adminPath}/login method=RequestMethod. POST)
Public String loginFail (it request, HttpServletResponse response, Model Model) {
Return "modules/sys/login/sysLogin";
}

}
Questions as follows:

Methods the login and loginFail corresponding @ RequestMapping (value="{adminPath} https://bbs.csdn.net/topics/$/login")

When \ LoginController login request sent to controller, the controller LoginController method how to decide the request is transferred to the login
Or method loginFail?

CodePudding user response:

The webmaster, please help reply

CodePudding user response:

Are you not the definition method different?

CodePudding user response:

LoginFail is a post request would leave if, if it's go a get request login,
Is the first request way is not specified, the get and post can be, but if it is a post request to come over, will request a given ways of this method

CodePudding user response:

The first POST and GET the second specified POST, so the request to the POST, will go to specify the POST.
  • Related