SSM关于注解:
Controller从路径中取参数的注解: @PathVariable
Eg:
@RequestMapping(“/item/{itemId}”)
@ ResponseBody
Public TbItem getItemById(@PathVariable long itemId){ }
参考文档:https://blog.csdn.net/qq_43047126/article/details/84302874
@RequestMapping("/test/{id}")路径参数和@RequestMapping("/test")键值对参数
@RequestMapping("/test/{id}")路径参数和@RequestMapping("/test")键值对参数
路径参数
@RequestMapping("/test/{id}")
public Girl girlFind(@PathVariable(“id”) String id){
return girlRepository.findOne(id);
}
此处在浏览器地址上…/test/{id}
{id}为需要传进去的详细id
键值对参数
@RequestMapping("/test")
public Girl girlFind(@RequestParam(“id”) String id){
return girlRepository.findOne(id);
}
其中@RequestParam(“id”)可写可不写
此处在浏览器地址上…/test?id={id}
{id}为需要传进去的详细id
@RequestMapping(“motaikuang.do”)
public List assistSearch(@RequestParam(value = “ID50001”) String ID50001,@RequestParam(value = “NA50002”) String NA50002, @RequestParam(value = “NA50001”) String NA50001, @RequestParam(value = “ID10001”) String ID10001) {
参考文档:https://jingyan.baidu.com/article/546ae185c816641148f28c66.html