【SpringBoot】Web开发之URL映射

@RequestMapping("/getDataById/{id}")

public String getDataById(@PathVariable("id") Long id){

return "getDataById:"+id;

}46

如果URL中的参数名称与方法中的参数名称一致,则可以简化为:

@RequestMapping("/getDataById/{id}")

public String getDataById(@PathVariable Long id){

return "getDataById:"+id;

}49

@RequestMapping("/getJson/*.json")

public String getJson(){

return "get json data";

}52

@RequestMapping(value="/getData",method=RequestMethod.GET)

public String getData(){

return "RequestMethod GET";

}

@RequestMapping(value="/getData",method=RequestMethod.POST)

public String PostData(){

return "RequestMethod.POST"

}58

相关推荐
好_快37 分钟前
Lodash源码阅读-dropRight
前端·javascript·源码阅读
好_快38 分钟前
Lodash源码阅读-drop
前端·javascript·源码阅读
珹洺39 分钟前
Java-servlet(完结篇)过滤器乱码解决与监听器
java·运维·服务器·hive·servlet·jsp
小开不是小可爱2 小时前
leetcode_383. 赎金信_java
java·数据结构·算法·leetcode
等等,要下雨2 小时前
linux安装ollama
linux·运维·服务器
程序猿chen2 小时前
安全岗の夺命连环问:(第壹篇)从XSS到0day的灵魂拷问
前端·git·安全·面试·跳槽·xss·改行学it
前端_yu小白3 小时前
js异步机制
前端·javascript·async·promise·await·js异步·回调地狱
Spider Cat 蜘蛛猫3 小时前
chrome extension开发框架WXT之WXT Storage api解析【补充说明一】
前端·javascript·chrome
kill bert5 小时前
Java八股文背诵 第四天JVM
java·开发语言·jvm
程序猿John6 小时前
ES6 新增特性 箭头函数
前端·javascript·es6