@ Requestmapping

Source: Internet
Author: User


1. @ requestmapping:
In dispatcher, handlermapping (to implement annotation at the type level) and handleradapter (to implement annotation at the method level) appear, which are default in dispatcherservlet and dispatcherportlet.

2. @ requestmapping annotation methods can have the following types of methods (in any order, unless the verification results need to be followed by the corresponding command image)

1). Request/response (servlet API or Portlet API)

2). session image (servlet API or Portlet API)

3). webrequest/nativewebrequest

4). inputstream/reader is used to access the requested content

5). outputstream/writer is used to generate the response content

6) parameters annotated with @ requestparam are used to access specific servlet/Portlet request parameters. The parameter value is converted to the declared method parameter type.

7). MAP/model/modelmap is used to enrich the hidden model exposed to the Web View.

8 ). bind parameters to the command/form object: bean attributes/fields with custom type conversion depend on the @ initbinder method/handleradapter configuration. For details, see the "webbindinginitializer" attribute of annotationmethodhandleradapter, such command pairs include their verification results and will be exposed as model attributes. By default, unqualified command class names (for example, for type "mypackage. orderaddress "use" orderaddress "). Specify a parameter-level modelattribute annotation for a specific model attribute name

9). The bindingresult verification result is used for the preceding command/form object (the preceding parameter)

10). sessionstatus processing is used to mark the form processing process as completed (triggering session attribute cleanup, which is indicated by @ sessionattribute annotation at the handle type level)

3. The @ requestparam annotation parameter is required by default. If @ requestparam (value = "ID", required = "false") is set, this parameter is optional.

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.