//一个方法处理一个请求,不能一个请求对应两个方法 @RequestMapping("/handle01") public String handle01() { System.out.println("RequestMappingTestController............handle01被调用"); return "success"; } @RequestMapping(value = "/handle02", method = RequestMethod.POST) public String handle02() { System.out.println("RequestMappingTestController............handle01被调用"); return "success"; } @RequestMapping(value = "/handle03", params={"username!=123","pwd","!age"}) public String handle03() { System.out.println("RequestMappingTestController............handle01被调用"); return "success"; } /** * User-Agent:浏览器信息 * 让IE能访问,让谷歌不能访问 * IE: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.73 * chrome User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36 * * @return */ @RequestMapping(value = "/handle04",headers = {"User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.73"}) public String handle04() { System.out.println("handle04............被调用"); return "success"; }
标签:return,RequestMapping,spring,System,Agent,002,537.36,handle01 From: https://www.cnblogs.com/xiaobaibailongma/p/16974031.html