Spring MVC Universal URI template__spring

Source: Internet
Author: User

Http://stackoverflow.com/questions/7841770/optional-path-variables-in-spring-mvc-requestmapping-uritemplate

Today asynchronous updates are made with Ajax and SPRINGMVC. Because the URI after the page jump is dynamically generated,/project/{depid}/{groid}/{projid}, and the URI in Ajax is either/project/{depid}/{groid}/{projid}/ Method.html or method.html, cannot map to the corresponding method in controller. It was later found that the following method,--**--, could match all the URIs ending with methods.

@RequestMapping (value = "/{first}/**/{last}", method = requestmethod.get) public
String test (@PathVariable (" ") string A,  @PathVariable (" Last ")  
  string last) {}

Which for the following URIs:

Foo/a/b/c/d/e/f/g/h/bar
Foo/a/bar
Foo/bar
Later, the classmate told me that similar situation to the controller in the requestmapping to/project/{depid}/{groid}/method can also be used, waiting for me to verify later.

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.