03-springmvc_requestmapping_ Request method

Source: Internet
Author: User

1. Standard HTTP request Header
2 mapping request parameters, request method, or request header 2.1 knowledge points
    • @RequestMapping can use request methods, request parameters, and request header mapping requests in addition to request URL mapping requests
    • @RequestMapping Vaule, method, params and Heads table request URL, request methods, request parameters and the mapping conditions of the request header, they are "with" the relationship between them, using multiple conditions together to make the request mapping more accurate
2.2 Test Method Property 2.2.1 Controller class
  
  1. @RequestMapping(value="/testMethod",method=RequestMethod.POST)
  2. public String testMethod(){
  3. System.out.println("testMethod");
  4. return "success";
  5. }
2.2.2 Request
    • Hyperlinks are using GET requests, so they will not succeed
 
   
  1. <a href="springmvc/testMethod">测试方法请求</a>
    • Form Request
  
  1. <form action="springmvc/testMethod" method="post">
  2. <input type="submit" value="提交">
  3. </form>

Donate US
The Mentor Studio has been working to help programmers learn to program more quickly and easily, and if you agree with our results and feel helpful, you are welcome to donate ^_^ to us.     

03-springmvc_requestmapping_ Request method

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.