获取路径参数
例如:http://localhost:8080/page/xiaoming/18
@RequestMapping(value="/page/{name}/{age}", method=RequestMethod.GET) public String getName(ModelMap map, @PathVariable("name") String name, @PathVariable("age") int age) { // some code ... }
获取URL参数
例如:http://localhost:8080/result?name=xiaoming&age=20
@RequestMapping(value="/result", method=RequestMethod.GET) public String resultParam(ModelMap map, @RequestParam String name, @RequestParam int age) { // some code ... }
参考:https://blog.csdn.net/lovelongjun/article/details/57416888
本站文章除注明转载/出处外,均为原创,若要转载请务必注明出处。转载后请将转载链接通过邮件告知我站,谢谢合作。本站邮箱:admin@only4.work
尊重他人劳动成果,共创和谐网络环境。点击版权声明查看本站相关条款。