File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Re: MVC Design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Re: MVC Design" Watch "Re: MVC Design" New topic

Re: MVC Design

Joe Cheung
Ranch Hand

Joined: Oct 18, 2002
Posts: 104
Dear all,
What is MVC Design? What I only know is it combines JSP and servlet to handle some complicated web applications by separating representation (JSP) and busines logic (Servlet).

eammon bannon
Ranch Hand

Joined: Mar 16, 2004
Posts: 140
MVC stands for Model - View - Controller, and is a design pattern independent of Servlet/JSP technology. It represents a way of building systems with three types of demarcated component: the Model, the View and the Controller. A Model is typically data, in the servlet/JSP world it could be a JavaBean which represents a row in a database table for example. The model does nothing more than hold data. A View is a component which can display Model components, and in the Sevlet/JSP world it is probably closest to a JSP (assuming the JSP contains only display logic). The Controller is the part which (it could be considered) handles navigation through the application, and would probably be a Servlet. Again, it would contain no data and no GUI code (i.e. no Model or View).
MVC pre-dates JSP/Servlet technology by some considerable time, and its a good idea to try and understand it independently of those two technologies. One of implementations of MVC in the Java world is Swing, and there is a good explanation of this here In the J2EE world Struts, is the most common implementation. It might help you to look at how this works.
(One small note, you can't have a proper MVC implementation as a WebApp - MVC requires two way communication to the view (i.e. changes in the model will be transmitted to the view) but this isn't possible due to the restrictions of HTTP)
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

you can't have a proper MVC implementation as a WebApp

True, but the Model 2 web application pattern is a good approximation of MVC given the restraints of the HTTP protocol.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Re: MVC Design
It's not a secret anymore!