[@Controller]5 详解@InitBinder

@InitBinder

org.springframework.web.bind.annotation.InitBinder

public @interface InitBinder

Annotation that identifies methods which initialize the WebDataBinder which will be used for populating command and form object arguments of annotated handler methods.

由这个注释标识的方法,它初始化WebDataBinder,这个WebDataBinder用于填充被@InitBinder注释的处理方法的commandform对象。

Such init-binder methods support all arguments that RequestMapping supports, except for command/form objects and corresponding validation result objects. Init-binder methods must not have a return value; they are usually declared as void.

这个@InitBinder方法支持RequestMapping支持的所有参数,command/form对象和相关校验结果。@InitBinder方法不能有返回值,它必须声明为void

Typical arguments are WebDataBinder in combination with WebRequest or Locale, allowing to register context-specific editors.

通常参数是WebDataBinder(由WebRequestLocale结合而成)。

方法

String[] value

The names of command/form attributes and/or request parameters that this init-binder method is supposed to apply to.

@InitBinder方法需要的Command/form的属性名称或请求的参数名称。

Default is to apply to all command/form attributes and all request parameters processed by the annotated handler class. Specifying model attribute names or request parameter names here restricts the init-binder method to those specific attributes/parameters, with different init-binder methods typically applying to different groups of attributes or parameters.

默认是所有的Command/form的属性名称或请求的参数名称。指定特定的名称是为了区别不同的参数。

转载于:https://www.cnblogs.com/JavaTechLover/archive/2012/09/03/spring-controller5.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值