struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Himanshu Ranavat" <>
Subject Struts visitorfieldvalidator invoked even when the getter is not invoked
Date Thu, 28 Aug 2008 21:24:25 GMT
I am using Struts Validation using annotations such as
FieldExpressionValidator and VisitorFieldValidator on the Person Object.
Now the wierd part is even though I do not invoke the getter on the
Person objects, struts starts to validate it. Is this correct behavior.
Shouldn't struts initiate validation only if the Person Object is being
used. The problem this is creating for me in another case is that when
the Person Object is not present, Struts still tries to validate. I know
I can check if the object exists then do validation but I want to
confirm if this is correct behavior and not a bug.....
This is my action class with validations:
public class PersonAction extends ActionSupport {
  private Person person = new Person();
  //VisitorFieldValidator will cause Struts to invoke validations on
Person Obj
  public Person getPerson() {
    return person;
  public void setPerson(Person person) {
    this.person = person;
  public String execute() {
    // do processing
    return SUCCESS;
This is my Person Business Object which uses field validator:
public class Person {
  public boolean isPersonInvalid() {
    return someValue;
      message="xyz", key="xyz",
 public int getX() { return x;}
 public vod setX(int p_x) {m_x = p_x;}
  private int x;

The interceptor stack includes ValidationInterceptor for PersonAction

This email and any attachments may contain confidential and proprietary
information of Xythos that is for the sole use of the intended
recipient.  If you are not the intended recipient, disclosure, copying,
re-distribution or other use of any of this information is strictly
prohibited.  Please immediately notify the sender and delete this
transmission if you received this email in error.

  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message