【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

相关推荐
FRing035 分钟前
vue3干货总结3(defineOptions(Vue3.3)、defineModel(Vue3.4)、Pinia)
开发语言·前端·vue.js·vue3
Bczheng19 分钟前
组件化服务端渲染模式SSR
前端
摇滚侠14 分钟前
《On Java 中文版 基础卷》阅读笔记 接口 18
java·笔记·python
CoderYanger43 分钟前
Java EE 进阶:9.MyBatis 操作数据库(进阶)(第八弹):MyBatis Generator
java·数据库·spring boot·spring·java-ee·tomcat·mybatis
whitelbwwww1 小时前
CUDA C++实战--中级
开发语言·前端·c++
张紫娃2 小时前
Chrome插件-Stylus(屏蔽博客广告)
前端·chrome·stylus
Yannik2 小时前
在 Apple Silicon Mac 上用 Jenkins + Fastlane 搭建 iOS CI:从自动打包到 MR 检查流水线的完整实践
前端
Nayana2 小时前
《Web 到 HarmonyOS》-- 打包:Vite 产物 → HAP / HAR / HSP
前端
inksci2 小时前
用飞帆做了个小网页
前端·javascript·css·html
去伪存真2 小时前
被 pnpm 打包坑惨后,我彻底盘明白了硬链接与软链接
前端·electron