The StrutsLive Framework

StrutsLive is a framework that adds powerful new capabilities to Struts 1.x, effectively turning it into a modern, component-based framework with features that rival those of Webobjects and Tapestry. One of the primary building blocks is a set of extensions to Struts that improve upon its default handling of Java objects nested in ActionForms. Semblance provides graceful handling of exceptions thrown during attempts to coerce request values to Java value types (e.g., Integer, Date, BigDecimal, etc.) by automatically treating them as validation errors.

The current release of StrutsLive also adds integration with the powerful new XML and XHTML templating capabilities of the Foundation Framework. It also provides support for the new ListView component, which automates dynamic queries and complex list management.

Major Features

The StrutsLive framework provides a powerful set of extensions to the core functionality in Struts 1.x, including a set of enhancements that allow graphs of POJOs (Plain Old Java Objects) to be easily nested in instances of ActionForm. This infrastructure provides graceful error handling for conversion exceptions thrown while attempting to convert string values from the request to JavaBean properties of various types (e.g., Date, BigDecimal, etc.) during ActionForm population.

The conversion error handling facilities include automatic posting of appropriate error messages (instances of ActionMessage), which are coalesced with any ActionErrors generated during validation, in effect allowing type coercion to be treated as a kind of validation. When coercion errors occur, the framework caches the values that were originally submitted to allow them to be presented back to the user for correction.

(Note: The current implementation of StrutsLive supports redisplay of invalid user input values in a way that is completely automatic for Struts tags and for Semblance Layout XHTML templates. If you are using JSP to render editable forms and you're not using Struts tags to render the input fields, a bit of extra work may be needed to automate the display of these values. Please feel free to contact me if you need guidance or assistance in getting this to work with the tag library you're currently using.)

StrutsLive also provides a registry for ValidationRule and Formatter classes that in combination with framework methods make for a simple but expressive mechanism for specifying conversion, formatting, and validation rules. The registry provides for specification of formatting and conversion rules by property type, and allows those rules to be overridden for specific properties. ValidationRules can be registered by property or at the form level (for cross-field validation). The set of included Formatter and ValidationRule classes provide common conversion, formatting, and validation functionality, and can be easily extended to accomodate the needs of a given application.

For most Struts-based applications, these features can dramatically reduce the size and complexity of the code required to populate a JavaBean graph with request values, by automating most formatting, conversion, validation, population, and error messaging tasks, allowing most of the required behavior to be specified declaratively (either through Java APIs or, when using the provided XHTML Layout capabilities, directly in the markup). Despite the addition of these features, StrutsLive is transparent to ordinary Struts-based application code, so adding it to your project won't force changes to the existing application.