Ten Step Development Plan
Before we proceed to start actual Project Development Plan, let's ask following question to yourself and decide whether struts apply to your project?
Identify the applicability to use Struts
- Does this project have many screens?
- Are there lots of interactions required by user?
- Is it important to have flexible configuration?
- Does this application fit into MVC architecture?
- Are the roles and responsibility of the team clearly defined?
Ten-step Development Program
- Gather and Define project requirement: Logical and most basic step in any application development plan. For example:
- A login system
- Add/Modify/Delete
- Search facility
- Display data in tabular or non-tabular format
- Session Management
- Define and Develop each screen requirement: After defining our requirement, we will define screen (UI) applicable for our project, example:
Screen
Data fields
Type
Comments
Logon
User name
String
textbox
Password
String
password
Add/modify/delete
Form, Table
Editable
Search
Filters
Drop down, text box
Display
Table, Div, XML
View only
- Determine all the access paths for each screen: Define how each screen will be access; it will define a logic flow for an application.
- Define the ActionMappings: To define what happens when the screen actually accessed. It's like a roadmap for Actions, which roadways should be taken define by ActionMappings. It is necessary to define what happens upon success, failure or any other process that's needs to be initiated from the resulting Action class.
- Create the ActionForms: The form class is correspondence to the data fields on a screen. All form classes in struts extend org.apache.struts.action.ActionForm or org.apache.sturts.action.DynaActionForm. The ActionForm is used to transfer data from a JSP and make it available in an object form that should correlate the data fields that we create in step 2 (Screen Requirement). The form class is also used for validation of form fields. An ActionForm class handles all the form variables (Setter/Getter methods) and has the necessary validation.
- Develop Actions: An action will take place for every situation or activity possible in an application. The ActionMappings should tell us what action needs to perform, as they are like the roadmap and tell us how we get from point A to point B. For example:
- Logon Action: Once the user logs on, it will check for authentication. If it succeed then the activity returns success else it returns failure.
- Insert Action: Take the inputs/data from form/JSP and insert in database. If the insert is successful, we will display a message else a failure will returns.
- Search Action: Returns the records that match criteria. If it succeeds, the DisplayAllAction will call to display the records returned in the record set.
- DisplayAllAction: Displays the current record set.
- LogOffAction: Log off user from current session.
- Develop the Application Business Logic: Application Business Logics are the core of any business application. Typically, they are written as JavaBeans or Enterprise JavaBeans. They are called from the appropriate Action class.
- Create JSPs: We look back at our workflow and see what success, failure or forward pages are necessary. It can easily itemize by at ActionMapping. Most of the forwards are probably JSP files, but it's not uncommon for actions to forward to another Action class.
- Build the appropriate configuration files: The web.xml is used by the Servlet container to determine the configuration of the various Servlets supported on that server. The struts-config.xml file is used by the controller Servlet (as defined in the web.xml) to declare ActionForms, ActionMappings and ActionClasses.
- Build, Test, Deploy: It can be treated as three different steps but here we will consider them together as a single step.
Disclaimer: The above steps are the extract from Morgan Kaufmann – The Struts Framework book, please refers to the book for detailed study.