@RequestParam就是把请求路径中的?后的key-value传给controller
不加@RequestParam
@RequestParam前端参数名称必须和后端controller上的形参变量名一样
且@RequestParam的参数 可以不传 非必传
加@RequestParam
@RequestParam的参数必须要传过来
但可以通过@RequestParam(required = false)设置为非必传,required值默认是true,所以默认必传
以通过@RequestParam(“userId”)或者@RequestParam(value = “userId”)指定参数名,也就是说,可以和前端传来参数名不一样,可以指定参数来接
可以通过@RequestParam(defaultValue = “0”)指定参数默认值