1 params and headers support for simple expressions
- PARAM1: Indicates that the request must contain a request parameter named param1
- !PARAM1: Indicates that the request cannot contain a request parameter named param1
- Param1!=value1: Indicates that the request contains a parameter named param1, but its value cannot be value1
- {"Param1=value1", param2}: The request must contain two request parameters named Param1 and param2, and the value of the param1 parameter must be value1
2 Testing the params2.1 controller class
@RequestMapping(value="/testParams",params={"username","age!=10"})
public String testParams(){
System.out.println("testParams");
return "success";
}
2.2 HTML
<a href="springmvc/testParams?username=imentor&age=10">测试参数</a>
Does not return to the success interface because the age=103 test headers
@RequestMapping(value="/testHeaders",headers={"zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3"})
public String testHeaders(){
System.out.println("testParams");
return "success";
}
Headers value, which can be obtained by firebug
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.
04-springmvc_requestmapping_ Request Parameters & Request Headers