------------I do not have him, but the hand is ripe, humble and foolish, and eager to be hungry-------------
Access can be specified, for example, you get to enter the landing page through the post to send Ajax database check or post to submit the user name password, and finally forwarded
It's a normal pattern.
With the restriction of access mode, you can only allow access to some kind of access, add the same path, or you can use different processing methods by different ways of access.
The cases are as follows:
Package Cn.dawn.day10annotationcontroller;import Org.springframework.stereotype.controller;import Org.springframework.web.bind.annotation.requestmapping;import Org.springframework.web.bind.annotation.requestmethod;import Javax.servlet.http.httpservletrequest;import Javax.servlet.http.HttpServletResponse;/** * Created by Dawn on 2018/3/24.*//*Annotation Definition Processor*/@Controller/*defining the Processor access path*/@RequestMapping ("/controller1") Public classMyacontroller {/*wildcard, only the POST request can access the*/@RequestMapping (Value="/login", method =requestmethod.post) Publicstring Dologin (String uname,string upwd) throws Exception {System. out. println (uname); System. out. println (UPWD); return " First"; } /*wildcard is only available if a GET request can access the*/@RequestMapping (Value="/login", method =requestmethod.get) PublicString Dologin () throws Exception {return " First"; }}
As you can see here: The method name and the value of the above annotation have access to the same path as the two, but, by the way the request is different, they will execute a different method
The way to visit the annotated development of SSM-SPRINGMVC-16:SPRINGMVC in small and medium-sized discourse