Hi,

I am using struts 2.0.11 and I am wondering about the following:

I have an action with a Long property that is using both validation and
conversion (a custom converter).
I have a RequiredFieldValidator and a ConversionErrorFieldValidator set for
that property, as follows:

@Conversion
@Validation
public class RequestAction extends ActionSupport
{
   private Long share;

  // etc...
  @RequiredFieldValidator(message = "Share value is required", shortCircuit
= true)
  @TypeConversion(converter = "
actions.converters.PositiveLongNotNullConverter")
  @ConversionErrorFieldValidator(message = "Share value must be greater than
or equal to zero", shortCircuit = true)
   public void setShare(Long share)
   {
      this.share = share;
   }
}


They are working, but in the JSP where the user fills in a form, if he
leaves the field empty, he gets the correct error message "Share value is
required". If however he places an invalid value in the field like "abc" for
example, he gets also the same error message, instead of "Share value must
be greater than or equal to zero". If I change the order of the annotations,
the opposite happens. With the shortCircuit, however the user always gets
the 2 errors messages, as expected.
So my question, is the RequiredFieldValidator is applied after conversion?
If conversion fails, the RequiredFieldValidator catches a blank value for
the field?

cheers


-- 
Filipe David Manana,
[EMAIL PROTECTED]

Obvious facts are like secrets to those not trained to see them.

Reply via email to