struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: FormBean Vs ModelBean dilemma
Date Wed, 16 Oct 2002 19:22:49 GMT

Another suggestion would be to consider your approach of:

1 page = 1 form bean = 1 model object.

I suggest that it's likely you could use less than 20 model components. In
fact, it's probably unlikely that you would model the business as having 20
model components except for the fact that you began with 20 pages.

In other words:

- Define model components at the 'business object level', for example
'Employee', 'Customer', etc. Avoid model components like, 'Customer Address
Page Model'.

 - Define methods on the Model Components that match business operations
such as 'Update Customer Address Info'. It's likely that these business
methods would match closely to your JSP pages. That is, you might have
'business method's for each of your 20 pages spread among your various
model components.

Tying your model components so tightly to your view components means that
whenever you change one, you'll have to change the other.

You may or may not have good luck cutting down the number of form beans.
Sometimes it's appropriate for one form bean to serve multiple pages,
sometimes not.

Best of luck,


Kevin Bedell
Author, Struts Kick Start

"David Graham" <> on 10/16/2002 02:37:47 PM

Please respond to "Struts Users Mailing List"

cc:     (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:    Re: FormBean Vs ModelBean dilemma

I don't see anything wrong with your setup.  Keep in mind that the reason
you have 2 hierarchies is so your business layer doesn't know what
environment it's running in.  You can reuse your model beans in a swing
application with no changes.  The form beans are only used in a struts web

You could pass your form beans directly into your business layer but that's
not very elegant and will be frowned upon by most architects.


>From: "Dan Tran" <>
>Reply-To: "Struts Users Mailing List" <>
>To: "Struts Users Mailing List" <>
>Subject: FormBean  Vs ModelBean  dilemma
>Date: Wed, 16 Oct 2002 10:20:37 -0700
>I am seeking for some advice on the best way to implement my project
>I have a bout 20 screens to display and persist into DB.
>I follow the tutorial on

>and implemented my prototype and ended up with 2 similar java object
>hierachies.  One for the
>form bean and one for the model bean.  As recommend by all expert on this
>list as well as Chuch's book,
>All action form bean's properties are String, the actionform beans are
>to the model beans to be persisted.
>The dilemma here is I have 2 similar groups of objects (and lots of set
>get methods to type) and scare the hell out
>my boss ;-)
>Any suggestion?
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Unlimited Internet access -- and 2 months free!  Try MSN.

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

This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.

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

View raw message