@RequestMapping Mapping Requests

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.