本文整理匯總了Java中org.springframework.web.bind.WebDataBinder.setValidator方法的典型用法代碼示例。如果您正苦於以下問題:Java WebDataBinder.setValidator方法的具體用法?Java WebDataBinder.setValidator怎麽用?Java WebDataBinder.setValidator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.web.bind.WebDataBinder
的用法示例。
在下文中一共展示了WebDataBinder.setValidator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder("employeeForm")
public void initBinder(WebDataBinder binder){
binder.setValidator(employeeValidator);
binder.registerCustomEditor(Date.class, new DateEditor());
binder.registerCustomEditor(Integer.class, "age", new AgeEditor());
}
示例2: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@Override
public void initBinder(WebDataBinder binder, WebRequest request) {
binder.setAutoGrowNestedPaths(this.autoGrowNestedPaths);
if (this.directFieldAccess) {
binder.initDirectFieldAccess();
}
if (this.messageCodesResolver != null) {
binder.setMessageCodesResolver(this.messageCodesResolver);
}
if (this.bindingErrorProcessor != null) {
binder.setBindingErrorProcessor(this.bindingErrorProcessor);
}
if (this.validator != null && binder.getTarget() != null &&
this.validator.supports(binder.getTarget().getClass())) {
binder.setValidator(this.validator);
}
if (this.conversionService != null) {
binder.setConversionService(this.conversionService);
}
if (this.propertyEditorRegistrars != null) {
for (PropertyEditorRegistrar propertyEditorRegistrar : this.propertyEditorRegistrars) {
propertyEditorRegistrar.registerCustomEditors(binder);
}
}
}
示例3: initBinderFileBucket
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder("fileUpload")
protected void initBinderFileBucket(WebDataBinder binder) {
binder.setValidator(fileValidator);
}
示例4: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder("personForm")
public void initBinder(WebDataBinder binder) {
binder.setValidator(personalValidator);
binder.registerCustomEditor(Integer.class, "biography.age",
new AgeConverter());
binder.registerCustomEditor(Integer.class, "education.year",
new YearConverter());
binder.registerCustomEditor(Date.class, "biography.birthDate",
new BirthDateConverter());
}
示例5: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
sdf.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));
binder.setValidator(this.validator);
}
示例6: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@SuppressWarnings("unused")
@InitBinder
private void initBinder(WebDataBinder binder) {
binder.initBeanPropertyAccess();
binder.setRequiredFields("sex");
LocalValidatorFactoryBean vf = new LocalValidatorFactoryBean();
vf.afterPropertiesSet();
binder.setValidator(vf);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
示例7: createBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@Override
public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.afterPropertiesSet();
WebDataBinder dataBinder = new WebDataBinder(target, objectName);
dataBinder.setValidator(validator);
return dataBinder;
}
示例8: createBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@Override
public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) throws Exception {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.afterPropertiesSet();
WebDataBinder dataBinder = new WebDataBinder(target, objectName);
dataBinder.setValidator(validator);
return dataBinder;
}
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:9,代碼來源:RequestResponseBodyMethodProcessorMockTests.java
示例9: initBinderProfileImage
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder("profileImageDTO")
protected void initBinderProfileImage(WebDataBinder binder) {
binder.setValidator(profileImageValidator);
}
示例10: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder
private void initBinder(WebDataBinder binder){
binder.setValidator(validator);
}
示例11: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder
protected void initBinder(WebDataBinder binder) {
binder.setValidator(userFormValidator);
}
示例12: initialiseBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder("product")
public void initialiseBinder(WebDataBinder binder) {
binder.setDisallowedFields("unitsInOrder", "discontinued");
binder.setValidator(productValidator);
}
示例13: init
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder
public void init(WebDataBinder binder) {
binder.setValidator(validator);
}
示例14: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder
private void initBinder(WebDataBinder webDataBinder)
{
webDataBinder.setValidator(validator);
}
示例15: initBinder
import org.springframework.web.bind.WebDataBinder; //導入方法依賴的package包/類
@InitBinder
private void initBinder(WebDataBinder webDataBinder) {
webDataBinder.setValidator(validator);
}