Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Difference between MVC1 and MVC2 architecture

843841Mar 21 2006 — edited Dec 14 2007
Hi,

Plz tell me the difference between MVC1 and MVC2 (struts)architectures. And also tell wht r the main advantages of strus framework.

Thanks,
Anil

Comments

798906
There is no such thing as MVC1 and MVC2.

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.

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.

Struts is Model 2 application framework.

http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/index.html
843841
YoGee is exactly right.
There is already a thread on this..

http://forum.java.sun.com/thread.jspa?threadID=430223&tstart=75
843841
Difference between Model 1 and Model 2 architecture:

Features of MVC1:

Html or jsp files are used to code the presentation. To retrieve the data JavaBean can be used.
In mvc1 archictecture all the view, control elements are implemented using Servlets or Jsp.
In MVC1 there is tight coupling between page and model as data access is usually done using Custom tag or through java bean call.
Features of MVC2:

The MVC2 architecture removes the page centric property of MVC1 architecture by separating Presentation, control logic and the application state.
In MVC2 architecture there is only one controller which receives all the request for the application and is responsible for taking appropriate action in response to each request.
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 11 2008
Added on Mar 21 2006
3 comments
668 views