1、@RequestMapping的请求头参数headers的用语与请求参数params的用法类似。
2、控制器TestRequestMappingController.java
package com.springmvc.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/springmvc")
public class TestRequestMappingController {
@RequestMapping(value="/testHeads", headers="Accept-Language=zh-CN,zh;q=0.8")
public String testHeads() {
System.out.println("testHeads");
return "success";
}
}
3、访问代码
<a href="<%=path%>/springmvc/testHeads">RequestMapping的请求头参数</a>