【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

相关推荐
twj_5023 小时前
农业商业计划书PPT制作完全指南
前端
门思科技3 小时前
ThinkLink Edge 本地部署实战:数据不出厂区,从硬件选型到与云端双向迁移
前端
花涧鹤3 小时前
学完分支和循环一脸茫然?我写了个扫雷,把它们全串起来了
前端
一条泥憨鱼4 小时前
【Redis | 黑马点评】基于Redis的消息队列 | stream消息队列 源码解读
java·数据库·redis·缓存·lua
aibo8603084 小时前
基于 Spring Boot + Vue3 的博物馆藏品管理系统设计与实现
java·spring boot·后端
fanruitian4 小时前
python 进程 线程
java·前端·python
\光辉岁月/4 小时前
javaSE8-新特性-Stream&Option
java·stream·option
ZoeLandia4 小时前
React03:useState 与不可变更新
前端·react.js·typescript·react
zzu123zsw4 小时前
把条件校验收敛到枚举接口:Spring Boot 统一断言模式与零污染异常切面工程化
java·spring boot·后端·架构设计
SL_staff4 小时前
计划系统落地难?从开发者视角重构执行入口体验
java·开源·全栈