Struts application example Last update : 24/09/2002 back to HOME PAGE

Introduction

The goal of this article is to illustrate how to use Struts framework and implement some of the J2EE Design Patterns through a very simple application. This article is in "BETA" version so please feel free to send me your comments (even if it's about spelling faults !).

Contents :

  1. Application presentation
  2. Class Diagram of the 3-tiers application using Struts and J2EE Design Patterns
  3. Sequence Diagram explaining the example
  4. Download the zip file with source code and the web archive file (war)
  5. Links about Struts and J2EE Design Patterns

To print the figures of this article, configure your printer in landscape mode.


back to Top
1. Application presentation

The example application is composed of 2 pages:


We would like that the user interface shows which lines are not valid by changing their background colour to red. The screen captures below illustrate this functionality :

Screen capture of fooInsert.jsp, before the submit

This page is composed of a table with 3 lines of text inputs

Screen capture of fooInsert.jsp, after the form is submitted :

The first line and the third line are not valid. An Error Message has been inserted before the table and the background colour of invalid lines has been updated to red.

back to Top

2. Class Diagram


Classes Description

back to Top

3. Sequence Diagram

Messages Description

The clients clicks on the link in the welcome page to go to insertFoo.jsp

back to Top

4. Download

The distribution file contains the source code, the javadoc files and the war. You can download it HERE.

In the build directory, there is a build.xml file. You need to have installed Ant 1.5 to use it ! Here is a short description of the targets:

dist is the default target.

back to Top

5. Links

Struts:

J2EE Design Patterns :

Gang of Four Patterns :

Factory Method

back to Top


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!)