Java Series Spring Learning--springmvc annotation parameter passing (vi)

Source: Internet
Author: User

First, the binding parameters are annotated as follows

  @RequestParam Bind the order request data, either as a parameter in the URL or as a parameter for a form submission or as a file to upload.

It has three properties:

value is used to set the parameter name.

The defaultvalue is used to set default values for parameters.

The required is used to set whether the required value is true by default. True, if the argument is empty, an error is encountered.

  

  @PathVariable parameter values in a bound URL

It has only one property value

Access Address: HTTP://LOCALHOST:8080/SPRINGMVC1/API/DEMOPATHVARIABLE/1

  

  @ModelAttribute Binding model parameters

The scope of the data in the model is requets level, that is, the model that is not available in the request request.

  

  

  

Java Series Spring Learning--springmvc annotation parameter passing (vi)

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.