springmvc之RequestMapping中的请求参数和请求头

2020-08-26 10:40:53 浏览数 (1)

代码语言:javascript复制
@RequestMapping("/springmvc")
@Controller
public class SpringmvcTest {
    private static final String SUCCESS = "success";
    
    @RequestMapping(value="testParams",method=RequestMethod.GET,params= {"username","age"},headers={...})
    public String testParams() {
        System.out.println("RequestmMapping");
        return SUCCESS;
    }
}

jsp页面:

代码语言:javascript复制
    <a href="springmvc/testParams?username=tom&age=18">testParams</a><br/>

用的比较少。

jsp

0 人点赞