Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re: MVC Design

 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
Regards,
Joe
 
eammon bannon
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 http://www.javaworld.com/javaworld/jw-04-1998/jw-04-howto.html. 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
Marshal
Pie
Posts: 64844
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic