MVC question

Hy there !What part of MVC approach the Struts Action and the Struts Form bean are: Model, View or Controller ?ThanksMarco
[150 byte] By [maazevedoa] at [2007-11-27 5:11:28]
# 1

As I understand it, there's a short answer and a long answer.

Short answer:

Servlet and config xmls = controller

Form = model (business data storage)

Action = model (business logic)

JSP (or whatever uses the Form as data bean): view

Long answer:

The same as short answer except that there's been many debates about the nuances between forms and actions, for whether example whether Struts Actions are actually part of the controller rather than model (and the other way around).

http://www.oracle.com/technology/products/jdev/tips/muench/adftoystore1012/images/mvc.gif

Codemonkeya at 2007-7-12 10:31:50 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

> What part of MVC approach the Struts Action and the

> Struts Form bean are: Model, View or Controller ?

Struts Action classes are part of the Controller. The Struts Form beans are part of the View.

Struts is a presentation framework for web applications. It provides a skeleton for application developers to build applications. There are no Model classes in the framework.

A domain/business model is created separately and then integrated with a Struts-based implementation.

A common misconception is to think that Action classes are how/where to build your Model. This is incorrect. Action classes are part of the Controller. This is how you add behavior to the Controller to suit the needs of your application. There shouldn't be any business logic inside the Action class. Action classes are part of the ActionServlet class. The ActionServlet class and its Actions are declaratively configured via struts_config.xml.

In Java EE three-tier applications, a Business Delegate is used as intermediary between the Presentation tier and the Business tier. The Model exists in the Business Tier. The Struts application exists in the Presentation tier. Action classes talk with a Business Delegate who lives in the Presentation tier and is the only one that can speak with the Model implementation.

See http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html

There are many other classes that make up a Struts-based Controller. Below are a few of the more important ones to be aware of:

ActionMapping

RequestProcessor

ActionForward

PlugIn

ServletException

GhostRadioTwoa at 2007-7-12 10:31:50 > top of Java-index,Other Topics,Patterns & OO Design...