springmvc 参数 代码_无分析

 

 

@Controller
public class HiController {

    //1. url上获取参数
    @RequestMapping("/variable/{id}")
    @ResponseBody
    public String getVariables(@PathVariable(value="id") String myId) {
        return myId;
    }

    //2. 参数名字不一致用@RequestParam
    @RequestMapping("name")
    @ResponseBody
    public String getParam(@RequestParam("name") String myName) {
        return myName;
    }
}

1:

 

 

 

 

2:

 

posted @ 2020-10-24 11:46  圣金巫灵  阅读(59)  评论(0编辑  收藏  举报