You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by roger <ro...@googlemail.com> on 2011/09/23 14:46:48 UTC

Bug? Further problems with @ConversionErrorFieldValidator in nested @VisitorFieldVisitor

In addition to the problem noted  in
http://struts.1045723.n5.nabble.com/Problem-with-ConversionErrorFieldValidator-td4829326.html
(which incidentally has also turned up at 
http://stackoverflow.com/questions/7514301/how-to-control-conversion-error-with-struts2
) I've come across a further issue with the @ConversionErrorFieldValidator.

In my main action I have;

    @VisitorFieldValidator
    public Customer getCustomer() {
           return customer;
    }

and with in Customer I have validation annotations including
@ConversionErrorFieldValidator.  Customer also contains a reference to
another Entity so within Customer I have 
    
    @Entity
    public class Customer {
    
    @ConversionErrorFieldValidator(message="Member Id must be numeric")
    public void setMemberId(int memberId) {
    this.memberId = memberId;
    }

    @RequiredStringValidator(message="customer name is required")
    public void setCustomerName(String customerName) {
    this.customerName = customerName;
    }

    @VisitorFieldValidator
    public Address getAddress() {
           return address;
    }

}

and withing Address I have further validation annotations. 

    @Entity
    public class Address() {

    @ConversionErrorFieldValidator(message="Area Code must be numeric")
    public void setAreaCode(int areaCode) {
             this.areaCode = areaCode;
    } 

     @RequiredStringValidator(message="Customer Address Line 1 is required")
     public void setAddressLine1(String addressLine1) {
              this.addressLine1 = addressLine1;
     }


Within Customer all of the validations work as expected although
@ConversionErrorFieldValidator still gives me two messages as noted in my
other post, which at least shows that it is being invoked. Within Address
the @RequiredStringValidator works as expected but
@ConversionErrorFieldValidator only gives me the Struts generated  message
which indicates that it is not being invoked when nesting
@VisitorFieldVisitor annotations. Has anyone else come across this?

Regards


--
View this message in context: http://struts.1045723.n5.nabble.com/Bug-Further-problems-with-ConversionErrorFieldValidator-in-nested-VisitorFieldVisitor-tp4833364p4833364.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org