You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Domen, Ken" <Ke...@nike.com> on 2002/02/21 01:06:50 UTC

how to decide how many beans to use?

I'm running into a problem.  

I started out with one FormBean.  It's basically a flattened domain object.
I'm using the Dave W. Validation package and in the validation.xml, you
define
that for a particular FormBean you validate certain fields.  Different pages
need validation on different fields so using only 1 FormBean won't work.

So do you create a new FormBean for each page that needs different
validations?

thanks.
ken



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: how to decide how many beans to use?

Posted by Ted Husted <hu...@apache.org>.
I use as few ActionForm (and Action) objects as possible. 

One thing to keep in mind is that a form bean is not an object, it's
name we give to an object. In the case of the Struts Validator, you
could give the same ActionForm class several different form bean names,
and validate each one differently.

In terms of custom validations, you can also create a base ActionForm
with all the properties you need, and use a subclass to provide
different validate or reset methods. 

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


"Domen, Ken" wrote:
> 
> I'm running into a problem.
> 
> I started out with one FormBean.  It's basically a flattened domain object.
> I'm using the Dave W. Validation package and in the validation.xml, you
> define
> that for a particular FormBean you validate certain fields.  Different pages
> need validation on different fields so using only 1 FormBean won't work.
> 
> So do you create a new FormBean for each page that needs different
> validations?
> 
> thanks.
> ken
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: how to decide how many beans to use?

Posted by keithBacon <ke...@yahoo.com>.
1 form bean per form.

--- "Domen, Ken" <Ke...@nike.com> wrote:
> I'm running into a problem.  
> 
> I started out with one FormBean.  It's basically a flattened domain object.
> I'm using the Dave W. Validation package and in the validation.xml, you
> define
> that for a particular FormBean you validate certain fields.  Different pages
> need validation on different fields so using only 1 FormBean won't work.
> 
> So do you create a new FormBean for each page that needs different
> validations?
> 
> thanks.
> ken
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>