Struts 1.1 Controller UML diagrams | Last update : 19/12/2003 | back to HOME PAGE |
|
Introduction |
The goal of this article is to illustrate the Struts 1.1 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.
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. Class diagrams |
Note
I have forgotten the association between the Action class and the ActionServlet. I will update the diagram after the summer ...
Application config, org.apache.struts.config package
ModuleConfigImpl contains a collection of static configuration information that describes an application module. For application initialization, struts-config.xml is parsed in order to dispatch mapping information in instances of ActionConfig, ForwardConfig and FormBeanConfig.
Example in struts-config.xml : <action path="/user" type="org.xxx.UserAction" name="userForm" scope="session">
ActionMapping extends ActionConfig and is not deprecated because of backward compatibility with version 1.02.
The parsing is done by using the famous jakarta Digester, which is a powerful component of XML - java objects mapping.
Struts Controller
The ActionServlet class is the core of the framework. It is an HTTPServlet which receives requests from the browser and forwards it depending on a configuration file : struts-config.xml.
The subclasses of Action are created and used by RequestProcessor. It is a wrapper around Business logic. To use Action, subclass it and overwrite the execute() method.
HTML Form management
Nb : You can still define your own ActionForm in the Struts 1.02 way, by sub-class ActionForm.
User classes
forwardedPage.jsp is not a class, it is the targeted jsp page. represents
the View in the Model view Controller model 2 pattern.
Error management
3. Sequence Diagram |
4 Links |
5 Use my diagrams |
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 :
ClassStruts1_1.gif, SequenceStruts1_1 submitted diagrams by Jean-Michel Garnier on October 02. Based on an article by Jean-Michel Garnier in the http://rollerjm.free.fr web site. Copyright (c) 1999-2002 The Apache Software Foundation. All rights reserved.
Credits |
Author
I am an European software engineer who lives and works in London. For any comments / suggestions : send an e-mail to g a r n i e r j m @ y a h o o.f r (remove the spaces to get my e-mail, I have done that bc the sobig virus has filled my mailbox!).
I am looking for a job. Ideally, I want to work on a J2EE web-project within a team applying Agile methods and using cutting edge technologies: Hibernate, Tapestry, Inversion of Control Frameworks, ... (Contract / Permanent). Please take a look at my CV.
Copyrights
The source is free to use and is available under the GNU GENERAL PUBLIC LICENSE.
|