SpringMVC之RequestMapping的對映和各個屬性
阿新 • • 發佈:2020-11-26
一、:
<a href="SpringMVCController/welcome">first springmvc</a>
可以通過對映:
@RequestMapping("welcome") public String welcome(){ return "success"; }
<form action="SpringMVCController/welcome" method="post"> name:<input name="name"><br/> age:<input name="age"> <input type="submit" value="確定"> </form>
可以通過對映:
@RequestMapping(value="welcome",method=RequestMethod.POST,params={"name=zs","age!=23","!height"}) public String welcome(){ return "success"; }
!height表示前臺jsp中的input標籤不能有height。
<a href="SpringMVCController/welcome2">first springmvc</a>
可以通過對映:
@RequestMapping(value="welcome2",headers={"Accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3","Accept-Encoding=gzip, deflate, br"}) public String welcome2(){ return "success"; }