Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / October 2004

Tip: Looking for answers? Try searching our database.

am I using my formbean appropriately?

Thread view: 
Dan Hicks - 24 Oct 2004 18:11 GMT
Hi,

I'm developing a web app and using struts for my view and controller.
I'm new to J2EE and was wondering if it's considered appropriate to
pass my action forms on to my model layer.  Form beans in struts I
think are considered part of my view.

On the model side, I have entity beans that contain other beans and
sometimes collections of other beans.  My form bean contains ID values
to represent these collections of beans within beans.  In other words,
I can't just call beanutils.copyproperties().  I am not using nested
beans for good reason.  So I'd like to create a similar functionality
to copy over the properties in my model.  My only hesitation in
passing the formbean over is that it may be considered bad form,
because formbeans are considered part of the view, and that makes my
model unusable for other apps (though I'm not expecting to use other
apps).  Anybody have any words of wisdom to impart on an MVC novice
such as myself?
Chris Soanes - 26 Oct 2004 08:32 GMT
> Hi,
>
> I'm developing a web app and using struts for my view and controller.
> I'm new to J2EE and was wondering if it's considered appropriate to
> pass my action forms on to my model layer.  Form beans in struts I
> think are considered part of my view.

You are correct, beans that extend ActionForm are part of the view. The
model should have no knowledge of these, so it's not (IMO) a good idea
to pass form beans to the model. Your saving grace in struts is going to
be the action classes, as you can use these to take the properties of
your form beans and pass massage them into the form your model needs.
This is my understanding of the 'C' in MVC pattern - you control the
interaction between the model and the view. I stand to be corrected,
however, as I'm an MVC n00b meself.

Tiff
Signature

Chris M Soanes: Sailor, Windsurfer, Cyclist, Biker, Snowboarder,
Swimmer, Dog Owner, and above all, Geek.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.