Code Comments
Programming Forum and web based access to our favorite programming groups.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?
Post Follow-up to this messageDan Hicks wrote: > 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 -- Chris M Soanes: Sailor, Windsurfer, Cyclist, Biker, Snowboarder, Swimmer, Dog Owner, and above all, G.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.