Summary The usage of @ RequestMapping in spring mvc. 1) The most basic method-level application, for example, Java code @ RequestMapping (value = "/ments") public String simplePattern () {System. out. println ("simplePattern method was called"); return "someResult";} When you access http: // localhost/xxxx/parameters, the simplePattern method is called. 2) java code @ RequestMapping (value = "/ments") public String findDepatment (@ RequestParam ("departmentId") String parameter mentid) {System. out. println ("Find departm Ent with ID: "+ inclumentid); return" someResult ";} in the form of access:/orders? Using mentid = 23 triggers access to the findDepatment method. 3. The REST-style parameter Java code @ RequestMapping (value = "/attributes/{inclumentid}") public String findDepatment (@ PathVariable String inclumentid) {System. out. println ("Find department with ID:" + faster mentid); return "someResult";} is a REST-style address access, for example,/departments/23, here, we use (@ PathVariable to receive rest-style parameters 4 REST-style parameter binding form 2) to look at the example first. This is a bit like the previous: Java code @ RequestMapping (value = "/ments/ {Inclumentid} ") public String findDepatmentAlternative (@ PathVariable (" inclumentid ") String someDepartmentId) {System. out. println ("Find department with ID:" + somestmmentid); return "someResult";} This is a bit different, that is, receiving URL access in the form of/contents/23, 23 is used as the passed metnid, but in the actual method findDepatmentAlternative, use @ PathVariable ("departmentId") String some1_mentid to bind it to some1_mentid. So here some1_mentid is 23 5 The url is bound to multiple IDs at the same time. Java code @ RequestMapping (value = "/attributes/{inclumentid}/employees/{employeeId}") public String findEmployee (@ PathVariable String inclumentid, @ PathVariable String employeeId) {System. out. println ("Find employee with ID:" + employeeId + "from department:" + finding mentid); return "someResult" ;}this is actually quite understandable. 6 support regular expression Java code @ RequestMapping (value = "/{textualPart: [a-z-] + }. {numericPart: [\ d] +} ") public String regularExpression (@ PathVariable String textualPart, @ PathVariable String numericPart) {System. out. println ("Textual part:" + textualPart + ", numeric part:" + numericPart); return "someResult";} For example, output: Textual part: sometext, numeric part: 123.