get请求
直接传参数
@RequestMapping("/us/{id}")
@ResponseBody
public String submitForm(@PathVariable(value = "id") String id) {
System.out.println("str=" + id);
return "提交成功";
}
使用?拼接传参
http://localhost:8081/us?name=nazha&age=18
@RequestMapping("/us")
@ResponseBody
public String submitForm(@RequestParam(value = "name") String name
, @RequestParam(value = "age")Integer age ) {
System.out.println("str=" + name);
System.out.println("age=" + age);
return "提交成功";
}
post请求
public String FFmpeg(@RequestBody Commands commands)
//会自动将json转化为Commands,一定要11对应