Back Forum Reply New

validation question in AbstractWizardFormController

Hi,

I have been getting a surprising validation error showing up in my wizard form controller.

All my validation is done in the validatePage method - but the error I am getting seems to be added to the Errors object before validatePage is called.

Code:
public void validatePage(Object obj, Errors errors, int currentPage) {
Listlt;FieldErrorgt; l = errors.getAllErrors();
for (FieldError errors : l) {
logger.info(quot;errors.toString() = 'quot; + errors.toString()+ quot;'quot;);
}
...
I can't see where the Errors object is instantiated, and I don't understand how some validation seems to have occurred before validatePage is called.

?

TIA.

John

There is binding happening, binding can also result in errors those are also added to the Errors object. I suggest you read chapter 13 of the referece guide, that explains the process that is happening.

mand.locationInfo.town,methodI  nvocation.locationInfo.town,methodInvocation.town,  methodInvocation.java.lang.String,methodInvocation]; arguments [org..context.support.DefaultMessage  SourceResolvable: codes [command.locationInfo.town,locationInfo.town]; arguments []; default message [locationInfo.town]]; default message [Property 'locationInfo.town' threw exception; nested exception is java.lang.NullPointerException]'

Yet the field 'town' is  a simple String, initialised as an empty String. It can't be null...

Confused!

So it is a bind exception. The fact that the town field is an empty string doesn't mean it cannot be null. Next to that your problem lies probablu in the fact that your LocationInfo is null, or at least yuor getLocationInfo returns null...

Next to that if you want answer to your question please ask the right/correct question....
¥
Back Forum Reply New