Introduction to Jakarta Struts Framework
Subject:   Model in MVC
Date:   2001-09-18 08:48:44
From:   browns
A great introduction to Struts I thought, but just a small point. You say that the "Model objects are typically application specific since they are basically the business logic of the application" but this isn't really the whole truth.

It is true to a degree, but the model in MVC represents the data that the view displays. Ignoring the ActionForm objects (as they are a little strange!), the model in an MVC based webapp would typically be JavaBeans or EJBs representing the underlying persistent business data. The problem (IMHO) is the ActionForm objects as they almost represent just a subset of the persistent data, just enough to handle the request.

While the "Controller" Servlet is the controller in MVC, Struts uses "command" like objects (subclasses of Action) that represent the processing associated with handling a request - this is the business logic. I see it as an extension to the controller and not the model.

(the J2EE patterns summarises this nicely as the "Command and Controller implementation strategy")

All in all a great article though and I wish that I had it when I was learning about Struts! Keep up the good work! :-)


Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Model in MVC
    2004-12-30 04:46:51  viku [View]

    This is a great introduction. Apart from there are several different ways to look at what constitutes a model for Struts.It's important to keep the business objects separate from the presentation so that the application is not tightly coupled to one type of presentation. It's likely that the look and feel of a web site will change over time. Studies show that the freshness of a web site's appearance helps to attract new customers and keep existing customers coming back. This may not be as true in the business-to-business (B2B) world, but it's definitely true for business-to-consumer (B2C) applications, which make up the majority of the web applications used today.