Meaningless Drivel is fun!*
The moose likes OO, Patterns, UML and Refactoring and the fly likes MVC 1 and MVC 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "MVC 1 and MVC 2 " Watch "MVC 1 and MVC 2 " New topic
Author

MVC 1 and MVC 2

jyothi godavarthy
Ranch Hand

Joined: Jan 28, 2004
Posts: 135
Hi whats the difference between the model 1 and model 2 MVC architecture, any good links on these will be useful.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

There is a good wiki page on MVC. It doesn't address MVC1 (which isn't used anymore), but it has a lot of good info.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Raja Raja
Greenhorn

Joined: May 17, 2003
Posts: 8
A Model 1 architecture consists of a Web browser directly accessing Web-tier JSP pages. The JSP pages access Web-tier JavaBeans that represent the application model, and the next view to display (JSP page, servlet, HTML page, and so on) is determined either by hyperlinks selected in the source document or by request parameters. A Model 1 application control is decentralized, because the current page being displayed determines the next page to display. In addition, each JSP page or servlet processes its own inputs (parameters from GET or POST). In some Model 1 architectures, choosing the next page to display occurs in scriptlet code, but this usage is considered poor form. (See the design guideline Section 4.2.6.8 on page 89.)

A Model 2 architecture introduces a controller servlet between the browser and the JSP pages or servlet content being delivered. The controller centralizes the logic for dispatching requests to the next view based on the request URL, input parameters, and application state. The controller also handles view selection, which decouples JSP pages and servlets from one another. Model 2 applications are easier to maintain and extend, because views do not refer to each other directly. The Model 2 controller servlet provides a single point of control for security and logging, and often encapsulates incoming data into a form usable by the back-end MVC model. For these reasons, the Model 2 architecture is recommended for most interactive applications.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
HI all,

Also I think MVC 2 would fit better in J2EE apps as usually we have this standard chaing,

JSP->Serlvet->Business Delegate->Session bean->Entity bean

Session bean --> Communicates with entity beans and prepares DTOs (Value objects)
Servlet--> Communiates with Session bean via Business Delegate and obtains DTOs
JSP --> Displays DTOs

This makes sense because if we have to have two versions of same application,
1. one with standards jsp/servlets (J2SE)
2. other based on J2EE using EJBs etc
then we can use the same JSPs/Servlets and change Business Delegates to query J2SE based implemenation without changing single line of code in Servlets and JSPs!!!

Thanks
Maulin
 
GeeCON Prague 2014
 
subject: MVC 1 and MVC 2