SpringMVC中@RequestMapping参数设置
URL路径由value决定,eg:value="/hello"。
method参数:RequestMethod.POST,RequestMethod.GET请求方法,比如GET、POST
除此之外,还有:
param:参数设置
@RequestMapping还支持ANT风格的通配符:
@RequestMapping(value="/?/world")
需要类似于http://localhost:8080/SpringHelloWorld/hello/4/world这样的请求才可以请求;4的位置可以换成任意一个字符但是必须有。
@RequestMapping(value="/*/world")
需要类似于http://localhost:8080/SpringHelloWorld/hello/aaaaaaaaaaaaaaaaaa/world这样的请求才可以请求;aaaaaaaaaaaaaaaaaa的位置可以换成任意多个(至少一个)字符但是必须有。
@RequestMapping(value="/**/world")
http://localhost:8080/SpringHelloWorld/hello/world可以处理该请求
http://localhost:8080/SpringHelloWorld/hello/1/2/3/4/world也可以处理该请求
也就是说,这种统配是可以中间掺杂任意多个这种结构,也可以没有;
凝一眸碧水,拈一缕清风,于一怀静谧中倾听凡尘的落音。
不再奢求什么,做简单的自己,过简单的生活,心在,梦在,你在,便是光阴赐予我的最美。