Re: Validator later rather than sooner?

2002-10-25 Thread Michael Delamere
Hi,

there is actually quite an easy way to do this.  Instead of your forms beans
being extended from "ValidatorForm", you should extend from
"ValidatorActionForm".
This means that you can validate on a per action basis.  This is how I did
it anyway.  Before I knew of this method I created three different form
beans to come over this.  This is not necessary however if you extend from
"ValidatorActionForm".

In the validation.xml you just use the action for the "name-attribute"
instead of the form name, i.e. 

HTH!

Regards,

Michael

p.s. Chucks book explains this quite well.




- Original Message -
From: "Michael Lee" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 8:52 PM
Subject: Re: Validator later rather than sooner?


Along the same thread, we are having a validation design problem.
We have broken most of our Action classes up into multiple classes. Before
we had one and used the property in the action mapping. That makes the
Action classes much more readable.
Problem is, these action classes still just use one ActionForm. This
ActionForm's validation method checks the parameter because the validation
for each page is different. This is starting to get large and unwieldy. I
don't want to have to create basically the same ActionForm for each Action
class when they are all mostly the same.
Question is, what is a clean way of breaking up all these validations?
Should I continue to check the action parameter and validate against it
within the same validation method for that one Action form? I was thinking
of extending the UserForm (the ActionForm in question) and just implementing
the validation method. This way I could also get rid of the parameter in the
action mapping of the struts-config.xml.
Thanks,
Mike


- Original Message -
From: "Richards, Devin N (Devin)" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 1:58 PM
Subject: RE: Validator later rather than sooner?


> Since the validator classes extend the standard struts classes, I would
get everything working correctly and then add the validator in after. We did
this and it worked well (except for the current bug of the validator not
supporting multiple resource bundles.)
>
> -Devin
>
>
> -Original Message-
> From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> Sent: Thursday, October 24, 2002 1:50 PM
> To: [EMAIL PROTECTED]
> Subject: Validator later rather than sooner?
>
>
> Is it general practice, or recommended, to develop a Struts application
> using the Action/ActionForm classes first (getting everything working
> properly) and later switch to the Validator classes, OR to use the
> Validator classes (implementing validation) right from the beginning?
>
> I have done a little with form validation, but not enough to know if I
> will get myself in trouble by waiting and "switching" class sets later on.
>
> Thanks,
> Susan Bradeen
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>

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



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




RE: Validator later rather than sooner?

2002-10-24 Thread Vincent PROSPER
John,

thats obviously what I did... The thing is even you only select a property
for your error message, you get the error... message (due to
Struts Validator). It of course doesn't happen if you only use your own
validate() methods without calling Struts Validator...

Vince

-Original Message-
From: John Nicholas [mailto:jakarta@;mobosplash.com]
Sent: Thursday, October 24, 2002 8:49 PM
To: Struts Users Mailing List
Subject: Re: Validator later rather than sooner?


Vincent PROSPER wrote:
>
> Another thing I dont like in Struts Validator is that 
> translation comes preformatted (error title is not i18N compliant,
> encapsulated in .. and with an ugly ): you loose the ability
> of putting a well displayed error beside each field of your form (this is
> not the case if you use Javascript Validator facility).
>

You can use  to output only the
error for that property and put that next to the form elements. Just
make the the errors.prefix, errors.suffix, etc blank or have more
appropriate formatting info.

John


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





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




Re: Validator later rather than sooner?

2002-10-24 Thread David Derry
Sorry. No I meant ValidatorActionFormdidn't realize that you
were on 1.0.2. Forget what I said. It applies to 1.1 using the Validator.

What about doing your validation in the Action rather than the forms
validate method? You could continue to use a common form (I'm guessing that
you mean a common form used by a number of different actions, and NOT that
there is just one form for the entire application). If I understand you
correctly you are saying that the validation is dependant on the action (as
I thought earlier). In that case the action would know what validation needs
to be performed? You could even implement a number of different validation
methods on the form, and the actions would call the appropriate validation
method.

Does this make more sense?

Dave Derry


- Original Message -
From: "Michael Lee" <[EMAIL PROTECTED]>


> If by ValidatorActionForm you mean ValidatingActionForm then I can't
> (shouldn't). It recommends what I suggested as a possible solution in the
> original post. That is, overriding the UserForm and using that form for
the
> appropriate action mapping in the struts-config.xml. I would be overriding
> the validate() of UserForm which is overriding validate() of ActionForm.
I'm
> using struts 1.0.2 btw.
>
> Javadocs for ValidatingActionForm
> "Deprecated. Application ActionForm beans should now extend ActionForm
> directly, and override the validate() method if they wish to provide such
> services"
> thanks,
> Mike
>
> - Original Message -
> From: "Dave Derry" <[EMAIL PROTECTED]>
>
> > You can also validate based on the action rather than the form. Just use
> the
> > action type rather than the form name, and be sure to extend
> > ValidatorActionForm rather than ValidatorForm.
> >
> > Dave Derry
> >
> > - Original Message -
> > From: "bachan s" <[EMAIL PROTECTED]>
> >



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




Re: Validator later rather than sooner?

2002-10-24 Thread David Graham
Maybe you could subclass the UserForm into AdminUserForm and EndUserForm?

David







From: "Michael Lee" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Re: Validator later rather than sooner?
Date: Thu, 24 Oct 2002 18:10:46 -0400

ActionForm reused across many actions, not the whole app. Its a UserForm.
Between admin create user, admin edit, end user edit and create, etc, it
would not make sense to have multiple aciton forms that all have 95% of the
same data. I'm just wondering how to split up the validator without using
parameters in the action mappings, which is how I do it now. The validator
becomes too huge.

- Original Message -
From: "David Graham" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 3:03 PM
Subject: Re: Validator later rather than sooner?


> You have one ActionForm class in your whole system?  If that's the case
then
> that's your main problem.  The rule is one ActionForm per logical html
form
> the user sees.
>
> It sounds like you used to have only one Action as well but split it up.
> That's what you should do with the forms.
>
> David
>
>
>
>
>
>
> >From: "Michael Lee" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: Validator later rather than sooner?
> >Date: Thu, 24 Oct 2002 14:52:30 -0400
> >
> >Along the same thread, we are having a validation design problem.
> >We have broken most of our Action classes up into multiple classes.
Before
> >we had one and used the property in the action mapping. That makes the
> >Action classes much more readable.
> >Problem is, these action classes still just use one ActionForm. This
> >ActionForm's validation method checks the parameter because the
validation
> >for each page is different. This is starting to get large and unwieldy. 
I
> >don't want to have to create basically the same ActionForm for each
Action
> >class when they are all mostly the same.
> >Question is, what is a clean way of breaking up all these validations?
> >Should I continue to check the action parameter and validate against it
> >within the same validation method for that one Action form? I was
thinking
> >of extending the UserForm (the ActionForm in question) and just
> >implementing
> >the validation method. This way I could also get rid of the parameter 
in
> >the
> >action mapping of the struts-config.xml.
> >Thanks,
> >Mike
> >
> >
> >- Original Message -
> >From: "Richards, Devin N (Devin)" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Sent: Thursday, October 24, 2002 1:58 PM
> >Subject: RE: Validator later rather than sooner?
> >
> >
> > > Since the validator classes extend the standard struts classes, I
would
> >get everything working correctly and then add the validator in after. 
We
> >did
> >this and it worked well (except for the current bug of the validator 
not
> >supporting multiple resource bundles.)
> > >
> > > -Devin
> > >
> > >
> > > -Original Message-
> > > From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> > > Sent: Thursday, October 24, 2002 1:50 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Validator later rather than sooner?
> > >
> > >
> > > Is it general practice, or recommended, to develop a Struts
application
> > > using the Action/ActionForm classes first (getting everything 
working
> > > properly) and later switch to the Validator classes, OR to use the
> > > Validator classes (implementing validation) right from the 
beginning?
> > >
> > > I have done a little with form validation, but not enough to know if 
I
> > > will get myself in trouble by waiting and "switching" class sets 
later
> >on.
> > >
> > > Thanks,
> > > Susan Bradeen
> > >
> > > --
> > > To unsubscribe, e-mail:
> ><mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > > For additional commands, e-mail:
> ><mailto:struts-user-help@;jakarta.apache.org>
> > >
> > > --
> > > To unsubscribe, e-mail:
> ><mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > > For addition

Re: Validator later rather than sooner?

2002-10-24 Thread Michael Lee
If by ValidatorActionForm you mean ValidatingActionForm then I can't
(shouldn't). It recommends what I suggested as a possible solution in the
original post. That is, overriding the UserForm and using that form for the
appropriate action mapping in the struts-config.xml. I would be overriding
the validate() of UserForm which is overriding validate() of ActionForm. I'm
using struts 1.0.2 btw.

Javadocs for ValidatingActionForm
"Deprecated. Application ActionForm beans should now extend ActionForm
directly, and override the validate() method if they wish to provide such
services"
thanks,
Mike

- Original Message -
From: "Dave Derry" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 3:26 PM
Subject: Re: Validator later rather than sooner?


> You can also validate based on the action rather than the form. Just use
the
> action type rather than the form name, and be sure to extend
> ValidatorActionForm rather than ValidatorForm.
>
> Dave Derry
>
> - Original Message -
> From: "bachan s" <[EMAIL PROTECTED]>
>
>
> >
> > Instead of writing different action forms you can have different entries
> in your struts config with the same Object type (i.e action form ).In this
> was you can have different rule for each form using the validator
framework.
> > Does this sound feasible.
>
> >  Michael Lee <[EMAIL PROTECTED]> wrote:Along the same thread, we are
> having a validation design problem.
> > We have broken most of our Action classes up into multiple classes.
Before
> > we had one and used the property in the action mapping. That makes the
> > Action classes much more readable.
> > Problem is, these action classes still just use one ActionForm. This
> > ActionForm's validation method checks the parameter because the
validation
> > for each page is different. This is starting to get large and unwieldy.
I
> > don't want to have to create basically the same ActionForm for each
Action
> > class when they are all mostly the same.
> > Question is, what is a clean way of breaking up all these validations?
> > Should I continue to check the action parameter and validate against it
> > within the same validation method for that one Action form? I was
thinking
> > of extending the UserForm (the ActionForm in question) and just
> implementing
> > the validation method. This way I could also get rid of the parameter in
> the
> > action mapping of the struts-config.xml.
> > Thanks,
> > Mike
> >
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>

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




Re: Validator later rather than sooner?

2002-10-24 Thread Michael Lee
ActionForm reused across many actions, not the whole app. Its a UserForm.
Between admin create user, admin edit, end user edit and create, etc, it
would not make sense to have multiple aciton forms that all have 95% of the
same data. I'm just wondering how to split up the validator without using
parameters in the action mappings, which is how I do it now. The validator
becomes too huge.

- Original Message -
From: "David Graham" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 3:03 PM
Subject: Re: Validator later rather than sooner?


> You have one ActionForm class in your whole system?  If that's the case
then
> that's your main problem.  The rule is one ActionForm per logical html
form
> the user sees.
>
> It sounds like you used to have only one Action as well but split it up.
> That's what you should do with the forms.
>
> David
>
>
>
>
>
>
> >From: "Michael Lee" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: Validator later rather than sooner?
> >Date: Thu, 24 Oct 2002 14:52:30 -0400
> >
> >Along the same thread, we are having a validation design problem.
> >We have broken most of our Action classes up into multiple classes.
Before
> >we had one and used the property in the action mapping. That makes the
> >Action classes much more readable.
> >Problem is, these action classes still just use one ActionForm. This
> >ActionForm's validation method checks the parameter because the
validation
> >for each page is different. This is starting to get large and unwieldy. I
> >don't want to have to create basically the same ActionForm for each
Action
> >class when they are all mostly the same.
> >Question is, what is a clean way of breaking up all these validations?
> >Should I continue to check the action parameter and validate against it
> >within the same validation method for that one Action form? I was
thinking
> >of extending the UserForm (the ActionForm in question) and just
> >implementing
> >the validation method. This way I could also get rid of the parameter in
> >the
> >action mapping of the struts-config.xml.
> >Thanks,
> >Mike
> >
> >
> >- Original Message -
> >From: "Richards, Devin N (Devin)" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Sent: Thursday, October 24, 2002 1:58 PM
> >Subject: RE: Validator later rather than sooner?
> >
> >
> > > Since the validator classes extend the standard struts classes, I
would
> >get everything working correctly and then add the validator in after. We
> >did
> >this and it worked well (except for the current bug of the validator not
> >supporting multiple resource bundles.)
> > >
> > > -Devin
> > >
> > >
> > > -Original Message-
> > > From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> > > Sent: Thursday, October 24, 2002 1:50 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Validator later rather than sooner?
> > >
> > >
> > > Is it general practice, or recommended, to develop a Struts
application
> > > using the Action/ActionForm classes first (getting everything working
> > > properly) and later switch to the Validator classes, OR to use the
> > > Validator classes (implementing validation) right from the beginning?
> > >
> > > I have done a little with form validation, but not enough to know if I
> > > will get myself in trouble by waiting and "switching" class sets later
> >on.
> > >
> > > Thanks,
> > > Susan Bradeen
> > >
> > > --
> > > To unsubscribe, e-mail:
> ><mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > > For additional commands, e-mail:
> ><mailto:struts-user-help@;jakarta.apache.org>
> > >
> > > --
> > > To unsubscribe, e-mail:
> ><mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > > For additional commands, e-mail:
> ><mailto:struts-user-help@;jakarta.apache.org>
> > >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:struts-user-unsubscribe@;jakarta.apache.org>
> >For additional commands, e-mail:
> ><mailto:struts-user-help@;jakarta.apache.org>
>
>
> _
> Broadband? Dial-up? Get reliable MSN Internet Access.
> http://resourcecenter.msn.com/access/plans/default.asp
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>

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




Re: Validator later rather than sooner?

2002-10-24 Thread Michael Lee
We do use the same form. That's the problem.

- Original Message -
From: "bachan s" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 3:02 PM
Subject: Re: Validator later rather than sooner?


>
> Instead of writing different action forms you can have different entries
in your struts config with the same Object type (i.e action form ).In this
was you can have different rule for each form using the validator framework.
> Does this sound feasible.
>  Michael Lee <[EMAIL PROTECTED]> wrote:Along the same thread, we are
having a validation design problem.
> We have broken most of our Action classes up into multiple classes. Before
> we had one and used the property in the action mapping. That makes the
> Action classes much more readable.
> Problem is, these action classes still just use one ActionForm. This
> ActionForm's validation method checks the parameter because the validation
> for each page is different. This is starting to get large and unwieldy. I
> don't want to have to create basically the same ActionForm for each Action
> class when they are all mostly the same.
> Question is, what is a clean way of breaking up all these validations?
> Should I continue to check the action parameter and validate against it
> within the same validation method for that one Action form? I was thinking
> of extending the UserForm (the ActionForm in question) and just
implementing
> the validation method. This way I could also get rid of the parameter in
the
> action mapping of the struts-config.xml.
> Thanks,
> Mike
>
>
> - Original Message -
> From: "Richards, Devin N (Devin)"
> To: "Struts Users Mailing List"
> Sent: Thursday, October 24, 2002 1:58 PM
> Subject: RE: Validator later rather than sooner?
>
>
> > Since the validator classes extend the standard struts classes, I would
> get everything working correctly and then add the validator in after. We
did
> this and it worked well (except for the current bug of the validator not
> supporting multiple resource bundles.)
> >
> > -Devin
> >
> >
> > -Original Message-
> > From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> > Sent: Thursday, October 24, 2002 1:50 PM
> > To: [EMAIL PROTECTED]
> > Subject: Validator later rather than sooner?
> >
> >
> > Is it general practice, or recommended, to develop a Struts application
> > using the Action/ActionForm classes first (getting everything working
> > properly) and later switch to the Validator classes, OR to use the
> > Validator classes (implementing validation) right from the beginning?
> >
> > I have done a little with form validation, but not enough to know if I
> > will get myself in trouble by waiting and "switching" class sets later
on.
> >
> > Thanks,
> > Susan Bradeen
> >
> > --
> > To unsubscribe, e-mail:
>
> > For additional commands, e-mail:
>
> >
> > --
> > To unsubscribe, e-mail:
>
> > For additional commands, e-mail:
>
> >
>
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:
>
>
>
> -
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site

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




Validator later rather than sooner?

2002-10-24 Thread Susan Bradeen
Is it general practice, or recommended, to develop a Struts application 
using the Action/ActionForm classes first (getting everything working 
properly) and later switch to the Validator classes, OR to use the 
Validator classes (implementing validation) right from the beginning? 

I have done a little with form validation, but not enough to know if I 
will get myself in trouble by waiting and "switching" class sets later on.

Thanks,
Susan Bradeen

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




Re: Validator later rather than sooner?

2002-10-24 Thread V. Cekvenich
If you do iterative development I add Validation in late iterations.
.V

Richards, Devin N (Devin) wrote:

Since the validator classes extend the standard struts classes, I would get everything working correctly and then add the validator in after. We did this and it worked well (except for the current bug of the validator not supporting multiple resource bundles.)

-Devin


-Original Message-
From: Susan Bradeen [mailto:SusanB@;softlanding.com]
Sent: Thursday, October 24, 2002 1:50 PM
To: [EMAIL PROTECTED]
Subject: Validator later rather than sooner?


Is it general practice, or recommended, to develop a Struts application 
using the Action/ActionForm classes first (getting everything working 
properly) and later switch to the Validator classes, OR to use the 
Validator classes (implementing validation) right from the beginning? 

I have done a little with form validation, but not enough to know if I 
will get myself in trouble by waiting and "switching" class sets later on.

Thanks,
Susan Bradeen

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




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




RE: Validator later rather than sooner?

2002-10-24 Thread Vincent PROSPER
Hi,

in my opinion - and small experience, I had not difficulties when switching
to the Validator.

The only things I had to do were:

- removing validateXXX() method, XXX being a (set of) field in my form
- adding the right rules in my validation.xml

Where you might get in trouble is that validator rules may not be as
accurate as your validateXXX() methods... (further programming is required).

Another thing I dont like in Struts Validator is that 
translation comes preformatted (error title is not i18N compliant,
encapsulated in .. and with an ugly ): you loose the ability
of putting a well displayed error beside each field of your form (this is
not the case if you use Javascript Validator facility).

Coming back to your question, you generally won't have any difficulties when
switching from ActionForm validation to Validator implementation and it's
really a convenient way to share pattern matching design between several
forms...

Vince

-Original Message-
From: Susan Bradeen [mailto:SusanB@;softlanding.com]
Sent: Thursday, October 24, 2002 7:50 PM
To: [EMAIL PROTECTED]
Subject: Validator later rather than sooner?


Is it general practice, or recommended, to develop a Struts application
using the Action/ActionForm classes first (getting everything working
properly) and later switch to the Validator classes, OR to use the
Validator classes (implementing validation) right from the beginning?

I have done a little with form validation, but not enough to know if I
will get myself in trouble by waiting and "switching" class sets later on.

Thanks,
Susan Bradeen

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





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




Re: Validator later rather than sooner?

2002-10-24 Thread Susan Bradeen
Excellent. Thank you (and Devin and Vince) for the quick response. I'd 
rather do things one step at a time, but I wasn't quite sure about this 
one!

Thanks again.

Susan




"V. Cekvenich" <[EMAIL PROTECTED]>
Sent by: news <[EMAIL PROTECTED]>
10/24/2002 02:04 PM
Please respond to "Struts Users Mailing List"

 
To: [EMAIL PROTECTED]
cc: 
    Subject:Re: Validator later rather than sooner?


If you do iterative development I add Validation in late iterations.
.V

Richards, Devin N (Devin) wrote:
> Since the validator classes extend the standard struts classes, I would 
get everything working correctly and then add the validator in after. We 
did this and it worked well (except for the current bug of the validator 
not supporting multiple resource bundles.)
> 
> -Devin
> 
> 
> -Original Message-
> From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> Sent: Thursday, October 24, 2002 1:50 PM
> To: [EMAIL PROTECTED]
> Subject: Validator later rather than sooner?
> 
> 
> Is it general practice, or recommended, to develop a Struts application 
> using the Action/ActionForm classes first (getting everything working 
> properly) and later switch to the Validator classes, OR to use the 
> Validator classes (implementing validation) right from the beginning? 
> 
> I have done a little with form validation, but not enough to know if I 
> will get myself in trouble by waiting and "switching" class sets later 
on.
> 
> Thanks,
> Susan Bradeen
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




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





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




Re: Validator later rather than sooner?

2002-10-24 Thread Michael Lee
Along the same thread, we are having a validation design problem.
We have broken most of our Action classes up into multiple classes. Before
we had one and used the property in the action mapping. That makes the
Action classes much more readable.
Problem is, these action classes still just use one ActionForm. This
ActionForm's validation method checks the parameter because the validation
for each page is different. This is starting to get large and unwieldy. I
don't want to have to create basically the same ActionForm for each Action
class when they are all mostly the same.
Question is, what is a clean way of breaking up all these validations?
Should I continue to check the action parameter and validate against it
within the same validation method for that one Action form? I was thinking
of extending the UserForm (the ActionForm in question) and just implementing
the validation method. This way I could also get rid of the parameter in the
action mapping of the struts-config.xml.
Thanks,
Mike


- Original Message -
From: "Richards, Devin N (Devin)" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 1:58 PM
Subject: RE: Validator later rather than sooner?


> Since the validator classes extend the standard struts classes, I would
get everything working correctly and then add the validator in after. We did
this and it worked well (except for the current bug of the validator not
supporting multiple resource bundles.)
>
> -Devin
>
>
> -Original Message-
> From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> Sent: Thursday, October 24, 2002 1:50 PM
> To: [EMAIL PROTECTED]
> Subject: Validator later rather than sooner?
>
>
> Is it general practice, or recommended, to develop a Struts application
> using the Action/ActionForm classes first (getting everything working
> properly) and later switch to the Validator classes, OR to use the
> Validator classes (implementing validation) right from the beginning?
>
> I have done a little with form validation, but not enough to know if I
> will get myself in trouble by waiting and "switching" class sets later on.
>
> Thanks,
> Susan Bradeen
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>

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




Re: Validator later rather than sooner?

2002-10-24 Thread John Nicholas
Vincent PROSPER wrote:


Another thing I dont like in Struts Validator is that 
translation comes preformatted (error title is not i18N compliant,
encapsulated in .. and with an ugly ): you loose the ability
of putting a well displayed error beside each field of your form (this is
not the case if you use Javascript Validator facility).



You can use  to output only the 
error for that property and put that next to the form elements. Just 
make the the errors.prefix, errors.suffix, etc blank or have more 
appropriate formatting info.

John


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



Re: Validator later rather than sooner?

2002-10-24 Thread David Graham
You have one ActionForm class in your whole system?  If that's the case then 
that's your main problem.  The rule is one ActionForm per logical html form 
the user sees.

It sounds like you used to have only one Action as well but split it up.  
That's what you should do with the forms.

David






From: "Michael Lee" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Re: Validator later rather than sooner?
Date: Thu, 24 Oct 2002 14:52:30 -0400

Along the same thread, we are having a validation design problem.
We have broken most of our Action classes up into multiple classes. Before
we had one and used the property in the action mapping. That makes the
Action classes much more readable.
Problem is, these action classes still just use one ActionForm. This
ActionForm's validation method checks the parameter because the validation
for each page is different. This is starting to get large and unwieldy. I
don't want to have to create basically the same ActionForm for each Action
class when they are all mostly the same.
Question is, what is a clean way of breaking up all these validations?
Should I continue to check the action parameter and validate against it
within the same validation method for that one Action form? I was thinking
of extending the UserForm (the ActionForm in question) and just 
implementing
the validation method. This way I could also get rid of the parameter in 
the
action mapping of the struts-config.xml.
Thanks,
Mike


- Original Message -
From: "Richards, Devin N (Devin)" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 1:58 PM
Subject: RE: Validator later rather than sooner?


> Since the validator classes extend the standard struts classes, I would
get everything working correctly and then add the validator in after. We 
did
this and it worked well (except for the current bug of the validator not
supporting multiple resource bundles.)
>
> -Devin
>
>
> -Original Message-
> From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> Sent: Thursday, October 24, 2002 1:50 PM
> To: [EMAIL PROTECTED]
> Subject: Validator later rather than sooner?
>
>
> Is it general practice, or recommended, to develop a Struts application
> using the Action/ActionForm classes first (getting everything working
> properly) and later switch to the Validator classes, OR to use the
> Validator classes (implementing validation) right from the beginning?
>
> I have done a little with form validation, but not enough to know if I
> will get myself in trouble by waiting and "switching" class sets later 
on.
>
> Thanks,
> Susan Bradeen
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>
>

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


_
Broadband? Dial-up? Get reliable MSN Internet Access. 
http://resourcecenter.msn.com/access/plans/default.asp


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



Re: Validator later rather than sooner?

2002-10-24 Thread bachan s

Instead of writing different action forms you can have different entries in your 
struts config with the same Object type (i.e action form ).In this was you can have 
different rule for each form using the validator framework.
Does this sound feasible.
 Michael Lee <[EMAIL PROTECTED]> wrote:Along the same thread, we are having a 
validation design problem.
We have broken most of our Action classes up into multiple classes. Before
we had one and used the property in the action mapping. That makes the
Action classes much more readable.
Problem is, these action classes still just use one ActionForm. This
ActionForm's validation method checks the parameter because the validation
for each page is different. This is starting to get large and unwieldy. I
don't want to have to create basically the same ActionForm for each Action
class when they are all mostly the same.
Question is, what is a clean way of breaking up all these validations?
Should I continue to check the action parameter and validate against it
within the same validation method for that one Action form? I was thinking
of extending the UserForm (the ActionForm in question) and just implementing
the validation method. This way I could also get rid of the parameter in the
action mapping of the struts-config.xml.
Thanks,
Mike


- Original Message -
From: "Richards, Devin N (Devin)" 
To: "Struts Users Mailing List" 
Sent: Thursday, October 24, 2002 1:58 PM
Subject: RE: Validator later rather than sooner?


> Since the validator classes extend the standard struts classes, I would
get everything working correctly and then add the validator in after. We did
this and it worked well (except for the current bug of the validator not
supporting multiple resource bundles.)
>
> -Devin
>
>
> -Original Message-
> From: Susan Bradeen [mailto:SusanB@;softlanding.com]
> Sent: Thursday, October 24, 2002 1:50 PM
> To: [EMAIL PROTECTED]
> Subject: Validator later rather than sooner?
>
>
> Is it general practice, or recommended, to develop a Struts application
> using the Action/ActionForm classes first (getting everything working
> properly) and later switch to the Validator classes, OR to use the
> Validator classes (implementing validation) right from the beginning?
>
> I have done a little with form validation, but not enough to know if I
> will get myself in trouble by waiting and "switching" class sets later on.
>
> Thanks,
> Susan Bradeen
>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:

>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:

>

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



-
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site


Re: Validator later rather than sooner?

2002-10-24 Thread Dave Derry
You can also validate based on the action rather than the form. Just use the
action type rather than the form name, and be sure to extend
ValidatorActionForm rather than ValidatorForm.

Dave Derry

- Original Message -
From: "bachan s" <[EMAIL PROTECTED]>


>
> Instead of writing different action forms you can have different entries
in your struts config with the same Object type (i.e action form ).In this
was you can have different rule for each form using the validator framework.
> Does this sound feasible.

>  Michael Lee <[EMAIL PROTECTED]> wrote:Along the same thread, we are
having a validation design problem.
> We have broken most of our Action classes up into multiple classes. Before
> we had one and used the property in the action mapping. That makes the
> Action classes much more readable.
> Problem is, these action classes still just use one ActionForm. This
> ActionForm's validation method checks the parameter because the validation
> for each page is different. This is starting to get large and unwieldy. I
> don't want to have to create basically the same ActionForm for each Action
> class when they are all mostly the same.
> Question is, what is a clean way of breaking up all these validations?
> Should I continue to check the action parameter and validate against it
> within the same validation method for that one Action form? I was thinking
> of extending the UserForm (the ActionForm in question) and just
implementing
> the validation method. This way I could also get rid of the parameter in
the
> action mapping of the struts-config.xml.
> Thanks,
> Mike
>



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




Re: Validator later rather than sooner?

2002-10-24 Thread bachan s

That also sounds good.
Can you please tell how this entry would look like in validation.xml if we want to 
validate based on action type.
 
 






maxlength
16


minlength
3





Thanks !

Bachan

 Dave Derry <[EMAIL PROTECTED]> wrote:You can also validate based on the action rather 
than the form. Just use the
action type rather than the form name, and be sure to extend
ValidatorActionForm rather than ValidatorForm.

Dave Derry

- Original Message -
From: "bachan s" 


>
> Instead of writing different action forms you can have different entries
in your struts config with the same Object type (i.e action form ).In this
was you can have different rule for each form using the validator framework.
> Does this sound feasible.

> Michael Lee wrote:Along the same thread, we are
having a validation design problem.
> We have broken most of our Action classes up into multiple classes. Before
> we had one and used the property in the action mapping. That makes the
> Action classes much more readable.
> Problem is, these action classes still just use one ActionForm. This
> ActionForm's validation method checks the parameter because the validation
> for each page is different. This is starting to get large and unwieldy. I
> don't want to have to create basically the same ActionForm for each Action
> class when they are all mostly the same.
> Question is, what is a clean way of breaking up all these validations?
> Should I continue to check the action parameter and validate against it
> within the same validation method for that one Action form? I was thinking
> of extending the UserForm (the ActionForm in question) and just
implementing
> the validation method. This way I could also get rid of the parameter in
the
> action mapping of the struts-config.xml.
> Thanks,
> Mike
>



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



-
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site


Re: Validator later rather than sooner?

2002-10-24 Thread Dave Derry
OK..now I haven't done this, so this is just based on my understanding.
If this is incorrect, hopefully someone else will step in.

Let's say that you have the following action mapping


Then in validation.xml change 


>
> That also sounds good.
> Can you please tell how this entry would look like in validation.xml if we
want to validate based on action type.
>
>  
> 
>  depends="minlength,maxlength">
> 
> resource="false"/>
> resource="false"/>
> 
> maxlength
> 16
> 
> 
> minlength
> 3
> 
> 
>
> 
>
> Thanks !
>
> Bachan
>
>  Dave Derry <[EMAIL PROTECTED]> wrote:You can also validate based on the
action rather than the form. Just use the
> action type rather than the form name, and be sure to extend
> ValidatorActionForm rather than ValidatorForm.
>
> Dave Derry
>



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