RE : RE : RE : Validator and Dispatch Actions

2003-08-27 Thread thomas Sontheimer
here is another means to do it:
http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorDispatchAction

> -Original Message-
> From: Trent Fisher [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 26, 2003 9:26 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE : RE : Validator and Dispatch Actions
> 
> 
> On this same note, if I were then calling a dispatch method 
> on that action 
> class to load/pre-populate the page, I would also need to 
> register yet 
> another actionMapping that would use the same action class 
> for the "type" 
> parameter, but would just call the load method instead one of 
> the submission 
> methods, correct?
I don't use a load method but I think you're right.

> 
> Basically, if I'm breaking this down correctly, if someone is using 
> Dispatch/LookupDispatch Action and the struts validator, they 
> would need 1 
> ActionMapping to call in order to load the page (and it's 
> dispatch method on 
> the action class) as well as 1 ActionMapping for each of the 
> "submission 
> possibilities" they had on their JSP... i.e., if you wanted 
> to validate 2 
> subsets of fields on the page, you'd have an actionmapping 
> for each of them.
> 
yes

> Isn't the struts-config going to get quite cluttered and 
> harder to follow if 
> this is the pattern used?
> 
it depends on how many actionMappings you need.

> Is there a different approach that is recommended vs. this one?
> 
yes, another means is proposed here:
http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorDispatchAction

> 
> 
> >From: "thomas Sontheimer" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" 
> <[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE : RE : Validator and Dispatch Actions
> >Date: Mon, 25 Aug 2003 17:04:35 +0200
> >
> >you don't need 2 action classes.
> >you may declare 2 actions in the struts-config.xml file 
> using the same 
> >class. but you have to declare 2 formset tags in the validation.xml 
> >file, setting up each form name with the action path instead of the 
> >form name.
> >
> >in the first formset tag you define validation rules for all 
> the fields 
> >and in the second you do it only for a part of them.
> >
> >using the first action will validate all the fields and using the 
> >second will validate only a part of them.
> >
> >thomas
> >
> > > -Original Message-
> > > From: Trent Fisher [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, August 25, 2003 4:05 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: RE : Validator and Dispatch Actions
> > >
> > >
> > > This being the case, say you had a situation where your 
> form had a 
> > > few fields that would be disabled/not displayed if a user didnt
> > > have a certain
> > > access level.
> > >
> > > If you wanted 2 separate validation schemes for this form 
> (one that 
> > > has all fields being validated, one that has all fields except for
> > > the "disabled/not
> > > shown" fields being validated) then you would need 2 action
> > > classes (or 2
> > > dispatch methods in the case below)?  If the actions will be
> > > executing
> > > similar, if not identical code based on the fields submitted,
> > > this seems
> > > like an awful lot of rework just to get the validation 
> accomplished.
> > >
> > >
> > >
> > >
> > > >From: "thomas Sontheimer" <[EMAIL PROTECTED]>
> > > >Reply-To: "Struts Users Mailing List"
> > > <[EMAIL PROTECTED]>
> > > >To: "'Struts Users Mailing List'" 
> <[EMAIL PROTECTED]>
> > > >Subject: RE : Validator and Dispatch Actions
> > > >Date: Mon, 25 Aug 2003 15:21:47 +0200
> > > >
> > > >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 Me

Re: RE : RE : Validator and Dispatch Actions

2003-08-26 Thread Trent Fisher
On this same note, if I were then calling a dispatch method on that action 
class to load/pre-populate the page, I would also need to register yet 
another actionMapping that would use the same action class for the "type" 
parameter, but would just call the load method instead one of the submission 
methods, correct?

Basically, if I'm breaking this down correctly, if someone is using 
Dispatch/LookupDispatch Action and the struts validator, they would need 1 
ActionMapping to call in order to load the page (and it's dispatch method on 
the action class) as well as 1 ActionMapping for each of the "submission 
possibilities" they had on their JSP... i.e., if you wanted to validate 2 
subsets of fields on the page, you'd have an actionmapping for each of them.

Isn't the struts-config going to get quite cluttered and harder to follow if 
this is the pattern used?

Is there a different approach that is recommended vs. this one?



From: "thomas Sontheimer" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE : RE : Validator and Dispatch Actions
Date: Mon, 25 Aug 2003 17:04:35 +0200
you don't need 2 action classes.
you may declare 2 actions in the struts-config.xml file using the same
class.
but you have to declare 2 formset tags in the validation.xml file,
setting up each form name with the action path instead of the form name.
in the first formset tag you define validation rules for all the fields
and in the second you do it only for a part of them.
using the first action will validate all the fields and using the second
will validate only a part of them.
thomas

> -Original Message-
> From: Trent Fisher [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2003 4:05 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE : Validator and Dispatch Actions
>
>
> This being the case, say you had a situation where your form
> had a few
> fields that would be disabled/not displayed if a user didnt
> have a certain
> access level.
>
> If you wanted 2 separate validation schemes for this form
> (one that has all
> fields being validated, one that has all fields except for
> the "disabled/not
> shown" fields being validated) then you would need 2 action
> classes (or 2
> dispatch methods in the case below)?  If the actions will be
> executing
> similar, if not identical code based on the fields submitted,
> this seems
> like an awful lot of rework just to get the validation accomplished.
>
>
>
>
> >From: "thomas Sontheimer" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE : Validator and Dispatch Actions
> >Date: Mon, 25 Aug 2003 15:21:47 +0200
> >
> >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]
> >
>
> _
> MSN 8: Get 6 months for $9.95/month
> http://join.msn.com/?page=dept/dialup
>
>
>
> -
> 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]
_
Get MSN 8 and enjoy automatic e-mail virus protection.  
http://join.msn.com/?page=features/virus

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

Re: RE : RE : Validator and Dispatch Actions

2003-08-26 Thread Robert Leland
thomas Sontheimer wrote:

Could you add this to the Validator Wiki FAQ ?

At :

http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorFAQ

Be sure to give yourself credit

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:

   

   
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

 

   

 




Re: RE : RE : Validator and Dispatch Actions

2003-08-25 Thread Trent Fisher
In this case, if I have one "Save" button on my page, and want either Action 
A or Action B to get executed, is the preferred method to set the "action" 
of the form dynamically in a function, something like:

fnSetAction()
{
 myForm.action="actionA";
 myForm.submit();
}
Or is there a different preferred way of accomplishing this?

Thanks

From: "thomas Sontheimer" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE : RE : Validator and Dispatch Actions
Date: Mon, 25 Aug 2003 17:04:35 +0200
you don't need 2 action classes.
you may declare 2 actions in the struts-config.xml file using the same
class.
but you have to declare 2 formset tags in the validation.xml file,
setting up each form name with the action path instead of the form name.
in the first formset tag you define validation rules for all the fields
and in the second you do it only for a part of them.
using the first action will validate all the fields and using the second
will validate only a part of them.
thomas

> -Original Message-
> From: Trent Fisher [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2003 4:05 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE : Validator and Dispatch Actions
>
>
> This being the case, say you had a situation where your form
> had a few
> fields that would be disabled/not displayed if a user didnt
> have a certain
> access level.
>
> If you wanted 2 separate validation schemes for this form
> (one that has all
> fields being validated, one that has all fields except for
> the "disabled/not
> shown" fields being validated) then you would need 2 action
> classes (or 2
> dispatch methods in the case below)?  If the actions will be
> executing
> similar, if not identical code based on the fields submitted,
> this seems
> like an awful lot of rework just to get the validation accomplished.
>
>
>
>
> >From: "thomas Sontheimer" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE : Validator and Dispatch Actions
> >Date: Mon, 25 Aug 2003 15:21:47 +0200
> >
> >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]
> >
>
> _
> MSN 8: Get 6 months for $9.95/month
> http://join.msn.com/?page=dept/dialup
>
>
>
> -
> 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]
_
Get MSN 8 and help protect your children with advanced parental controls.  
http://join.msn.com/?page=features/parental

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