You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ha...@informatiefabriek.nl on 2003/11/20 10:37:52 UTC

Validator Framework & Value Object ActionForm

Hi all,

I have the following action form:

/*
 * Created on Nov 19, 2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package nl.informatiefabriek.addressbook.form;

import nl.informatiefabriek.addressbook.value.ContactValue;

import org.apache.struts.action.ActionForm;

/**
 * @author harm
 *
 * @struts.form name = "contactForm"
 */
public class ContactForm extends ActionForm {
        private ContactValue contactValue = new ContactValue();
 
        /**
         * @return Returns the contactValue.
         */
        public ContactValue getContactValue() {
                return contactValue;
        }

        /**
         * @param contactValue The contactValue to set.
         */
        public void setContactValue(ContactValue contactValue) {
                this.contactValue = contactValue;
        }

}

As you can see my Action Form only stores a ValueObject (Data Transfer 
Object) which is send to the EJB tier in my application.
My ValueObject contains a property 'email'.:

<snippet>
 public java.lang.String getEmail()
   {
          return this.email;
   }

   public void setEmail( java.lang.String email )
   {
          this.email = email;
          emailHasBeenSet = true;

   }
</snippet>

I would like to use the Validator Framework to validate the emailaddress 
stored in the ValueObject. 

I'm not sure on how to do this, because the email property is stored in 
the Value Object and not in the ActionForm object.

Can somebody provide me a hint on how to validate this using the Validator 
Framework?

Thanks,

Harm de Laat
Informatiefabriek
The Netherlands


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


RE: Validator Framework & Value Object ActionForm

Posted by Steve Armstrong <bi...@sympatico.ca>.
Hi,

I assume that you would just validate on the nested form property named
"contactValue.email".

Cheers,
-Steve

-----Original Message-----
From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
Sent: Thursday, November 20, 2003 4:38 AM
To: struts-user@jakarta.apache.org
Subject: Validator Framework & Value Object ActionForm


Hi all,

I have the following action form:

/*
 * Created on Nov 19, 2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package nl.informatiefabriek.addressbook.form;

import nl.informatiefabriek.addressbook.value.ContactValue;

import org.apache.struts.action.ActionForm;

/**
 * @author harm
 *
 * @struts.form name = "contactForm"
 */
public class ContactForm extends ActionForm {
        private ContactValue contactValue = new ContactValue();

        /**
         * @return Returns the contactValue.
         */
        public ContactValue getContactValue() {
                return contactValue;
        }

        /**
         * @param contactValue The contactValue to set.
         */
        public void setContactValue(ContactValue contactValue) {
                this.contactValue = contactValue;
        }

}

As you can see my Action Form only stores a ValueObject (Data Transfer
Object) which is send to the EJB tier in my application.
My ValueObject contains a property 'email'.:

<snippet>
 public java.lang.String getEmail()
   {
          return this.email;
   }

   public void setEmail( java.lang.String email )
   {
          this.email = email;
          emailHasBeenSet = true;

   }
</snippet>

I would like to use the Validator Framework to validate the emailaddress
stored in the ValueObject.

I'm not sure on how to do this, because the email property is stored in
the Value Object and not in the ActionForm object.

Can somebody provide me a hint on how to validate this using the Validator
Framework?

Thanks,

Harm de Laat
Informatiefabriek
The Netherlands


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



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