On Fri, 2005-04-01 at 06:01 -0500, Ted Husted wrote: > Well, you know, an ActionForm is what it is. :) > > On this list, most people will tell you it belongs to the View. >
To shorten Ted's post: This depends on your viewpoint. Inside the presentation layer it's 100% the model. If you are talking about the presentation layer, refer to ActionForm as Model. If you are talking about the system architecture, the whole presentation layer is a view on the business layer. In this case ActionForm is part of the view. regards Leon > Other frameworks with similar architectural members call gizmos like > ActionForms the "Model". Why? Because in classic MVC, the View > subscribes to the Model, most often as an Observer. In a conventional > Model 2 application, the View acquires data from the servlet contexts > --- meaning the servlet contexts become the M in MVC. The JSP Tags > "observe" critters like the ActionForm in the servlet contexts, hence, > the argument would go, it's part of the Model. Snagging data from the > contexts is not quite the Observer pattern, but it does have the same > effect. > > Of course, since most, or all, of that data actually comes from a > database, a lot of people tend to think of the database as the Model. > And, in the big picture, the database usually is the one-true Model. > But from the narrow perspective of Model-2 MVC, the JavaBeans we stuff > into the servlet contexts do become, for all intents and purposes, the > Model. > > One way to think of it is that our Views aren't designed to gaze upon > the Model directly. So, the Controller creates a specialized form of > the Model and places that chunk in the servlet context, where the > Views can see it. From the View's perspective, the dynamic data in the > servlet contexts is the Model. (Even though we know it's just a > runtime snapshot of one sliver of the most-high database Model.) > > As to ActionForms in particular, personally, I consider everything in > the Struts core (Action package) to be part of our Controller layer. > The taglibs are our View, but the rest, including the ActionForm, is > part of the Controller. The Controller simply shares the ActionForm > with the View by putting it the Servlet context (so it becomes part of > the Model as observed by the View). > > Of course, in the end, it doesn't really matter. The ActionForm is > what the ActionForm is. The one thing it is not, is a business object. > The Controller creates it from the request, and it bounces around > between the Action and the JSP Tags (or other View Tools). But, it > should *never* go past the Action into another layer. > > Aside from that key best practice -- the ActionForm should never go > past the Action into another layer -- we might as well be discussing > how many angels can dance on the head of a pin :) > > -Ted. > > On Mar 31, 2005 11:40 PM, atta-ur rehman <[EMAIL PROTECTED]> wrote: > > Dea all, > > > > I'm sure I've seen this topic before! Just can't remember where and > > google won't help either! Can anybody please explain which MVC layer > > form belongs? > > > > TIA. > > > > ATTA > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]