• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Re: MVC Design

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic