Java Code Examples for org.springframework.validation.BindingResult#getErrorCount()

The following examples show how to use org.springframework.validation.BindingResult#getErrorCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServletAnnotationControllerHandlerMethodTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@RequestMapping("/bind")
public BindStatusView handle(@Valid DataClass data, BindingResult result) {
	if (result.hasErrors()) {
		return new BindStatusView(result.getErrorCount() + ":" + result.getFieldValue("param1") + "-" +
				result.getFieldValue("param2") + "-" + result.getFieldValue("param3"));
	}
	return new BindStatusView(data.param1 + "-" + data.param2 + "-" + data.param3);
}
 
Example 2
Source File: MvcNamespaceTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@RequestMapping
public void testBind(@RequestParam @IsoDate Date date,
		@RequestParam(required = false) @PercentNumber Double percent,
		@MyValid TestBean bean, BindingResult result) {

	this.date = date;
	this.percent = percent;
	this.recordedValidationError = (result.getErrorCount() == 1);
}
 
Example 3
Source File: ServletAnnotationControllerHandlerMethodTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@RequestMapping("/bind")
public BindStatusView handle(@Valid DataClass data, BindingResult result) {
	if (result.hasErrors()) {
		return new BindStatusView(result.getErrorCount() + ":" + result.getFieldValue("param1") + "-" +
				result.getFieldValue("param2") + "-" + result.getFieldValue("param3"));
	}
	return new BindStatusView(data.param1 + "-" + data.param2 + "-" + data.param3);
}
 
Example 4
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@RequestMapping
public void testBind(@RequestParam @IsoDate Date date,
		@RequestParam(required = false) @PercentNumber Double percent,
		@MyValid TestBean bean, BindingResult result) {

	this.date = date;
	this.percent = percent;
	this.recordedValidationError = (result.getErrorCount() == 1);
}
 
Example 5
Source File: MvcNamespaceTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@RequestMapping
public void testBind(@RequestParam @IsoDate Date date, @RequestParam(required = false) @PercentNumber Double percent, @MyValid TestBean bean, BindingResult result) {
	this.date = date;
	this.percent = percent;
	this.recordedValidationError = (result.getErrorCount() == 1);
}