springMVC中的注解@RequestParam与@PathVariable

@PathVariable是用来获得请求url中的动态参数的

@RequestMapping("/kf/{date}")
public void example_1(@PathVariable(value = "date") String type) {}

@RequestParam注解主要有哪些参数:
value:参数名字,即入参的请求参数名字
required:是否必须,默认是true,表示请求中一定要有相应的参数
defaultValue:默认值,表示如果请求中没有同名参数时的默认值

@RequestMapping(value = "/service",method = RequestMethod.GET)
public void example_2(@RequestParam String type) {}

你可能感兴趣的:(java)