springmvc-@RequestMapping Mapping Request

Source: Internet
Author: User

@RequestMapping Mapping Requests
1.SpringMVC uses @requestmapping annotations to specify which URL requests can be processed by the controller.
2. @requestmapping can be annotated at the controller's class definition and method definition.
(1). Class definition: Provides preliminary request mapping information. The root directory relative to the Web App.
(2). Provides further subdivision mapping information. Relative to the URL at the class definition.
If @requestmapping is not marked at the class definition,
The URL that is tagged at the method is relative to the Web app's root directory.
3.DispatcherServlet intercepts the request, it is @requestmapping through the controller
The mapping information provided determines the processing method that the request corresponds to.

@Controller @requestmapping ("/hello")  Public class Hellocontroller {    @RequestMapping ("/helloworld")    public  String Helloword () {        System.out.println ("Hello world!" );         return "Success";    }}


code example:

springmvc-@RequestMapping Mapping Request

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.