@RequestParam

@RequestParam注解主要有哪些参数:

public String other(Locale locale, Principal principal)

public String requestparam1(@RequestParam String username)

public String requestparam2(@RequestParam("username") String username)

value:参数名字,即入参的请求参数名字,如username表示请求的参数区中的名字为username的参数的值将传入;

required:是否必须,默认是true,表示请求中一定要有相应的参数,否则将报404错误码;

defaultValue:默认值,表示如果请求中没有同名参数时的默认值,默认值可以是SpEL 表达式,如

“#{systemProperties['java.vm.version']}”。

猜你喜欢

转载自liuna718-163-com.iteye.com/blog/2215919