I tend to think it's either you NOT use DispatchAction if you have
different validation requirements for the same form. The validator ties to
only one form per action and since DispatchAction is still considered a
single action (with different delegated methods), then you are still bound
to use only one set of validation rules for that form.

Option 1

     Use DispatchAction and implement your own validate() method for that
form

Option 2

     Split your operations into different actions using the same form,
define different rules in the validation.xml and have your form extend
ValidatorActionForm like Peter suggested





Peter Onthrops <[EMAIL PROTECTED]> on 06/07/2002 02:34:40 PM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   Struts Users Mailing List <[EMAIL PROTECTED]>
cc:
Subject:  Re: Struts Validator



I think what you are looking for is handled by configuring validation.xml
in this way:
<formset>
 <form    name="action1"> (maps to action path)
         <field    property="field1" ....
         <field    property="field2" ....
         <field    property="field3" ....
  </form>

 <form    name="action2">
         <field    property="field1" ....
  </form>

</formset>


Your Form bean should extend ValidatorActionForm. The Validator will only
validate fields configured for the given action. Hope this helps.

P.



  Robert Taylor <[EMAIL PROTECTED]> wrote: I want to leverage the
declarative validation functionality offered by the
Struts Validator package, but I have some reservations about how it works.
In my particular configuration, my application will use DispatchActions to
process common events.
In many cases I will use one ActionForm for all events being processed by a
particular ActionForm. Since I won't be validating all fields in all cases,
I want to only validate certain fields for a particular action mapping. The
only way I can tell how to do this is to use the page data member of
ValidatorActionForm to identify those fields that need be validated.

The problem I see with this, is ...
- for mapping A, I may want to validate field1, field2, and field3, and
- mapping B, I only want to validate field1, but
- mapping C, I want to validate field1 and field3.

Is this possible to do using the validation.xml file. That is, can you do
something like the following:

...
...
...

where 1 = mapping for A,
2 = mapping for B,
3 = mapping for C

If not, how is this possible? Is there a validator DTD I can reference?


robert


--
To unsubscribe, e-mail:
For additional commands, e-mail:



---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup





**********************************************************************
Please Note:
The information in this E-mail message, and any files transmitted
with it, is confidential and may be legally privileged.  It is
intended only for the use of the individual(s) named above.  If you
are the intended recipient, be aware that your use of any confidential
or personal information may be restricted by state and federal
privacy laws.  If you, the reader of this message, are not the
intended recipient, you are hereby notified that you should not
further disseminate, distribute, or forward this E-mail message.
If you have received this E-mail in error, please notify the sender
and delete the material from any computer.  Thank you.
**********************************************************************




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

Reply via email to