In my bean I have a list
List<SomeClass> values = new ArrayList<SomeClass>(); SomeClass{ int a; int b; int c; }
My verification code is
int i =0 for(SomeClass entry: values){ if(entry.getA() < 0 && entry.getB() < 0 && entry.getC() > 0){ bindingResult.addError(newFieldError("bean", "values[" + i"].a", values.get(i).getA(),false,new String []{"error.code"}, null, null)); } }
error.code maps to String " If C is greater than zero, then A and B must be greater than zero "
The problem is that I want to map the error code to values[i].a , as well as values[i].b , so that these two fields are highlighted in the user interface.
The FieldError constructor accepts a String field , not a String [] fields .
Is it possible to add two error fields for the same error?
thanks
source share