struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Cancro <DCan...@bridgespan.com>
Subject RE: Struts + MVC Philosophical question
Date Thu, 11 Jul 2002 16:37:58 GMT
My favorite reason for insulating the view from the model is because
otherwise, you could encounter errors in the middle of serving a page and
the users would see a half-finished page.  With insulation (via controller),
you can make sure that all data retrieval by a page is foolproof.  When you
don't have web pages that start going to the browser before they are totally
done being generated, you don't have to worry about this problem.

> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: Thursday, July 11, 2002 5:16 AM
> To: Struts Users Mailing List
> Subject: Re: Struts + MVC Philosophical question
> 
> 
> Struts really encourages a Layered Model 2/MVC architecture. Using a
> Layered arcitechture, it is incorrect for non-adjacent layers 
> to develop
> direct dependencies. The View should talk to the Controller and the
> Controller should talk to the Model. 
> 
> The original M/V/C framework, Smalltalk, made good use of the Observer
> pattern to streamline processing. The View could register a listener
> with the Model and be apprised of any change. Though, that is not
> something many people would do today, since it violates the Layers
> pattern that evolved from MVC. If the whole shooting match evolved in
> today's environment, I believe the Observer pattern would have been
> applied differently, and the View would register with the Controller,
> which would then monitor the Model on the View's behalf.
> 
> So, you're right, the original MVC pattern does not prevent the View
> from chatting with the Model and updating itself. The stricter Layers
> pattern that Web applications use on top of MVC does. But typing
> Layered/Model 2/MVC takes too long, and developers are lazy 
> that way :o)
> 
> So hereabout MVC does mean Smalltalk/Go4 MVC, it means Layered/Model
> 2/MVC. There's talk about christening that Web MVC or MVC2, 
> but there's
> not a solid reference for that yet.
> 
> Ade Barkah wrote:
> > 
> > To nitpick...
> > 
> > In a strictly philosophical terms, in MVC, the View *may* (and
> > should!) directly access the Model, and on startup one *may* go
> > straight to a View without passing through a Controller. Also,
> > the Model *may* populate its own data without the help of a
> > Controller.
> > 
> > Of course when applying MVC to web applications, it's best if
> > all user requests go through a control layer, but MVC "per se"
> > does not mandate it. This practice is often referred to as the
> > "Front Controller" pattern.
> > 
> > For reference, see how MVC is applied in Smalltalk, Swing or
> > even MFC. :)
> > 
> > regards,
> > -Ade
> > 
> > -----Original Message-----
> > From: Martin Cooper [mailto:martin.cooper@tumbleweed.com]
> > Sent: Wednesday, July 10, 2002 9:41 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Struts + MVC Philosophical question
> > 
> > > -----Original Message-----
> > > From: Struts Newsgroup [mailto:struts@basebeans.com]
> > > Sent: Wednesday, July 10, 2002 6:40 PM
> > > To: struts-user@jakarta.apache.org
> > > Subject: Struts + MVC Philosophical question
> > >
> > >
> > > Subject: Struts + MVC Philosophical question
> > > From: "André Augusto de Oliveira Aragão" <andre_aug@hotmail.com>
> > >  ===
> > > HI!
> > >
> > > I'm using struts to develop an application. I have an action,
> > > that has an
> > > input page, and a result page. However, the input page needs
> > > information
> > > that is in the model. Following mvc, I can´t access the model
> > > directly from
> > > view. With struts, the input page is called before 
> calling the action.
> > > Strictly following MVC, how can I populate the input page
> > > with model info I
> > > need? Any ideas?
> > 
> > Following MVC, you should not be bypassing the controller 
> and going straight
> > to the view. ;-) The answer is to go through an action to 
> get to the input
> > page. The action can then set up any beans the input page 
> will need, and
> > then forward to it.
> > 
> > --
> > Martin Cooper
> > 
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> > 
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: 
> <mailto:struts-user-help@jakarta.apache.org>
> 
> -- Ted Husted, Husted dot Com, Fairport NY US
> -- Java Web Development with Struts
> -- Tel: +1 585 737-3463
> -- Web: http://husted.com/about/services
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:struts-user-help@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message