Struts-2 Tutorial previous    print     download     next

An Exploration of Struts-2

The following articles build upon the creation of a simple name and address-book web application. The first three steps create the application and connect it to a database. The following steps continue layering additional technologies and techniques on to the core application. These articles were written as a way for the author to collect together in one place the lessons learned while experimenting with Struts version 2.

The goal is to minimize complexity in the tutorial so that the central concepts can be seen clearly. The final web application is not production quality since testing and validation issues are only minimally considered. The user interface is a bit contrived in order to perform all CRUD functions within a single form.

A Struts2 CRUD Tutorial in 3 Steps
R. Kevin ColeApril 2, 2007

This tutorial implements a simple name and address data entry form. Data from the form is submitted to an action which uses a service to store the address in a database.

The purpose of this tutorial is the implementation of a simple Create, Read, Update and Delete (CRUD) web application using the Struts-2 framework. The CRUD application will be created using Spring dependency injection (Inversion of Control) for object creation and Hibernate with annotations for data access services.

The tutorial consists of the following three steps.

  1. Step 1   Setup the initial project structure and control files. An address-entry view is created along with a controller action and a model bean to receive the address data.
  2. Step 2    Enable Spring dependency injection and inject a list of U.S. States into the action and configure a struts select tag to use it.
  3. Step 3    Enable Hibernate and use it to create, read, update and delete address records in a database.

The product of each step will be a ready-to-run web appliction packaged in a war file. The steps can be taken in order or just jump directly to the final one and use it.

Decorating a Struts-2 Application with SiteMesh
R. Kevin ColeApril 4, 2007

In Decorating the Address-Book Using SiteMesh, the address-book application has a header, footer and navigation bar attached to it using the SiteMesh page decorator.