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:[EMAIL PROTECTED]]
> 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:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 10, 2002 6:40 PM
> > To: [EMAIL PROTECTED]
> > Subject: Struts + MVC Philosophical question
> >
> >
> > Subject: Struts + MVC Philosophical question
> > From: "André Augusto de Oliveira Aragão" <[EMAIL PROTECTED]>
> >  ===
> > 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:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- 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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to