> -----Original Message-----
> From: Leandro Melo [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 08, 2004 10:25 AM
> To: Struts Users Mailing List
> Subject: RE: ActionForm with all application attributes
> 
> 
>  --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> > 
> > 
> > > -----Original Message-----
> > > From: Leandro Melo
> > [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, September 08, 2004 9:48 AM
> > > To: Struts Users Mailing List
> > > Subject: RE: ActionForm with all application
> > attributes
> > > 
> > > 
> > > Jim, all the code i`m talking about is inside a
> > Base
> > > Action Form. It seems the you`re thinking that my
> > code
> > > is inside a action, aren`t you?? Maybe a
> > > misundertanding, maybe mine, maybe yours.
> > 
> > No, I understood you to have it in a Base Action.
> > 
> > > 
> > > So, i agree with some of your comments, but not on
> > all
> > > of thems. In fact, i`m gonna to take a look about
> > this
> > > customized classes to use with validator.
> > 
> > Another trick, is to use the same AcitonForm class,
> > but call it different things.  Since validator will
> > work by name, and not by class you can customize
> > based on that alone.  You can also validate a form
> > by action mapping, rather then by form name.
> 
> 
> Would you mind showing an example on how to do that?

http://struts.apache.org/api/org/apache/struts/validator/ValidatorActionForm.html
As opposed to ValidatorForm.  
The following is from memory, but should be close.
Assuming the following struts-config.xml
blah blah
<form-bean name="ChangeAddressForm" 
type="com.sssc.csr.web.forms.BorrowerDemographicsForm"></form-bean>
blah blah
<action path="/changeAddress" 
        name="ChangeAddressForm" 
        validate="true" 
        type="com.sssc.csr.web.actions.ChangeAddressAction" 
        scope="request">

        <forward name="success" path="changeAddress"></forward>

</action>

Normaly, your validation.xml would look like:
<form name="ChangeAddressForm">
blah blah.
</form>

Using the path mapping you would have the following in your validation.xml:
blah blah
<form name="/changeAddress">
blah blah.
</form>

AND, don't forget inherit from ValidatorActionForm, as oppposed to ValidatorForm.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to