Struts Controller UML diagrams | Last update : 20/10/2002 | back to HOME PAGE |
|
Introduction |
The goal of this article is to illustrate the Struts Controller with UML diagrams. This article is an introduction to the Struts framework in order to help beginners programmers to understand the MVC model 2. I have written a new version of this article updated for Struts 1.1, please have a look (here!) and feel free to send me your comments.
Contents :
To print the figures of this article, configure your printer in landscape mode.
1. Context description |
In order to show how to use the Struts framework classes, I have designed some diagrams starting from a simple example : a client submits a form to a "forwarded" page :
struts-config.xml
This is the configuration resource file - which is parsed by the Struts Controller for initialization.
2. Struts 1.02 Controller Class Diagram |
org.apache.struts.action package description
The ActionServlet class is the core of the framework. It is a servlet which receives requests from the browser and forwards it depending on a configuration file : struts-config.xml.
For application initialization, the configuration file is parsed in order to dispatch mapping informations in instances of ActionMapping, ActionForward and ActionFormBean.
The Action class is created and used by ActionServlet. It is a wrapper around Business logic. To use Action, subclass and overwrite the perform() method.
ActionForm represents a general concept of data that is set or updated by a HTML Form. Struts will automatically set the state of the UserActionForm using the corresponding fields from the HttpServletRequest.
User classes description
forwardedPage.jsp is not a class, it is the targetted jsp page.
3. Sequence Diagram |
Messages Description
4 Links |
Ted Husted's Struts MVC resources page : http://www.husted.com/struts/links.htm#mvc
Model View Controller model 2 in Struts documentation : http://jakarta.apache.org/struts/userGuide/introduction.html#mvc
Introduction of MVC by sun : http://java.sun.com/blueprints/patterns/j2ee_patterns/model_view_controller/index.html
Presentation of Struts, MVC 2 with a detailled example : http://www-106.ibm.com/developerworks/library/j-struts/
Other presentation of Struts, with J2EE patterns : http://www.sys-con.com/java/article.cfm?id=1175
5 Credits |
Author
I am a French developer who lives in London (CV).
Copyrights
I have given all the diagrams to the Apache Software Foundation. However, if you want to use it for commercial purposes, please send me an e-mail.
Otherwise, you can use it if you add the following credits :
ClassStrutsMVC2.gif, SequenceStrutsMVC2.gif submitted diagrams by Jean-Michel Garnier on April 02. Based on article by Jean-Michel Garnier in the http://rollerjm.free.fr web site. Copyright (c) 1999-2001 The Apache Software Foundation. All rights reserved.
|
|
For any comments / suggestions :Jean-Michel Garnier |