I have developed my way around this issue, but I wanted to pass it by you to see if my
logic is not flawed.
In the example given with the Struts packages, it performs validation within a form
like so:
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
// Perform validator framework validations
ActionErrors errors = super.validate(mapping, request);
// Only need crossfield validations here
if (!password.equals(password2))
{
errors.add("password2",
new ActionError("error.password.match"));
}
return errors;
}
I believe that an error will be raised at the line beginning errors.add(. The reason
is the super.validate will return a null if no errors are created within it, and you
canât perform an âaddâ on a null object. Therefore, the code should look like
this:
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
// Perform validator framework validations
ActionErrors errors = super.validate(mapping, request);
// Only need crossfield validations here
if (!password.equals(password2))
{
if (errors == null)
errors = new ActionError();
errors.add("password2",
new ActionError("error.password.match"));
}
return errors;
}
Am I correct in my logic? I have tested this and I find it to be true.
Christopher
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]