if you want to use different validation rules with the validator you
have to declare different action elements in your struts-config.xml file
(using the same action class if you want).

another means is to validate your form in the methods of your action
class as propose Koni in the mail sent on the list Monday, August 25,
2003 8:04 PM:

struts-config.xml:

        <action    path="/logon/action/logon"
                   type="test.web.struts.action.logon.LogonAction"
                   name="logonForm"
                  scope="request"        <-- !!!
               validate="false"          <-- !!!
                  input="/WEB-INF/jsp/logon/logon.jsp">
             <forward   name="success"   path="/index.jsp"/>
        </action>

LogonAction.java:

   ActionErrors errors = new ActionErrors();
   errors = form.validate(mapping, request);

   // Report any errors we have discovered back to the original form
   if (!errors.isEmpty())
   {
       saveErrors(request, errors);
       return  new ActionForward(mapping.getInput());
   }

thomas

> -----Original Message-----
> From: manglu [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 26, 2003 5:44 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE : Validator and Dispatch Actions
> 
> 
> Thomas,
> 
> How do i have 3 actions here?
> 
> I have only one action with three methods each working on 
> SEARCH, CREATE 
> and EDIT.(which is why i use the dispatch Action)
> 
> Appreciate any other thoughts.
> 
> TIA,
> Manglu
> 
> 
> 
> thomas Sontheimer wrote:
> > you have to use (Dyna)ValitatorActionForm instead of 
> > (Dyna)ValidatorForm. Then in your validation.xml file for each new 
> > rule you specify you have to replace the name of the form 
> by the name 
> > of the action using the form. And the rule will be applied 
> to the form 
> > only if it's called from the action you gave the name.
> > In your case you have to specify 1 form, 3 actions and 3 rules.
> > 
> > thomas
> > 
> > 
> >>-----Original Message-----
> >>From: manglu [mailto:[EMAIL PROTECTED]
> >>Sent: Tuesday, August 26, 2003 1:33 AM
> >>To: [EMAIL PROTECTED]
> >>Subject: Validator and Dispatch Actions
> >>
> >>
> >>Hi,
> >>
> >>I want to use the Struts Validator to do validation.
> >>
> >>
> >>The Same action form is used for SEARCH, CREATE and EDIT.
> >>
> >>The validation rules for each of them is different( from the
> >>other two)
> >>
> >>How do i go about defining such a config in the validation
> >>config file.
> >>
> >>Appreciate any help.
> >>TIA
> >>Manglu
> >>
> >>
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to