1, SPRINGMVC use@RequestMapping NoteThe solution specifies which URL requests can be processed for the controller. 2, in the Controller class definition and method definition can be labeled @requestmapping 2.1at the class definition: Provides preliminary request mapping information. Root 2.2 relative to the web AppMethod at: Provides further subdivision mapping information. Relative to the URL at the class definition. 3, Dispatcherservlet intercept the request, the Controller on the @requestmapping provided by the mapping information to determine the corresponding processing method of the request. 4. @RequestMappingrequest URL (value), request method, request parameter (params), Request header Mapping (heads)--PARAM1: parameter must contain param1--! PARAM1: parameter cannot contain param--param1! =value1: Must contain Param, and the value is not equal to value1--{"param1=value1", "param2"}: param1 and param2 must be included, and param1 value equals value1
5.ant StyleThe resource address supports a match in 3:
- ? : Matches one of the characters in the file name;
/user/??? User match:/user/adduser/user/edtuser
-*: Matches any character in the file name;
/user/*/adduser Matching:/user/my/adduser/user/system/adduser
--* *: matching multi-layer paths
/user/**/adduser Matching:/user/adduser/user/system/my/adduser
6.URL with placeholderis a new feature of Spring3.0
With @pathvariable, you can bind placeholder parameters in URLs to the arguments in the controller processing method @RequestMapping ("/delete/{ID}")
Public String Delete (@PathVariable ("id")Integer ID) {
Userdao.delete (ID);
return "Redirect:/user/list.do";
}
@RequestMapping Mapping Requests