Springmvc common annotations and functions

Source: Internet
Author: User

I. Notes for spring MVC
@ Controller
The class defined above indicates that the class is a controller and returns the string and redirect: XXX
@ Requestmapping
Use this annotation on the class or method to set the URL access address. It has two attributes: value specifies the access path, and method specifies the request method. The request method is defined in the requestmethod class in constant form. By default, it uses GET requests.
@ Requestparam
Specify the request parameter, which is defined in the method parameter, which is equivalent to the traditional request. getparameter ().
@ Pathvariable
Get the URL access path variable, which is spring
The features added to the MVC 3.0 framework are based on restful URL access paths.
@ Modelattribute
A global method is executed every time in a set of URL access paths, and the returned results of the method are saved in the module session.
@ Service
As defined above, the class to be annotated is a business logic component. If no bean ID is specified, the default naming method is used, that is, the first letter of the class name is lowercase. Previously in SSH2, elephants used @ repository for Dao components. In this example, only the business layer is used, so they only use the @ service annotation.
@ Autowired
The IOC automatic injection function replaces the previous set statement and is used in SSH2.
@ Qualifier
You can specify a specific implementation class for different implementations of the same interface class.
@ Responsebody
It is also defined in the method. The Ajax call declaration specifies that the result returned by the method is the result of the Ajax callback function. This is spring
A new feature added to the MVC 3.0 framework.
@ Initbinder
Initialize Data Binding and type conversion, convert incoming parameters to custom types, or customize parameters.

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.