Accessibility
Anirudh Sasikumar

Anirudh Sasikumar

http://anirudhs.chaosnet.org/

Table of Contents

Created:
20 October 2008
User Level:
Intermediate
Products:
Flex

Bridging the gap between Flex and Struts using FxStruts

Apache Struts is an incredibly popular open source framework for building Servlet/JSP based web applications on the Model-View-Controller (MVC) design paradigm. The view layer in Struts is HTML, but the isolation between the view and rest of the pieces ensures that Flex can easily replace HTML. The migration or creation of such an application with a Flex front end requires transforming the existing view layer to output XML, SOAP, or AMF.

FxStruts helps developers who are familiar with Struts to easily move to Flex by providing the glue code necessary for the transformation of the existing view layer. FxStruts is a free open source library that provides replacements for Struts (version 1.x.x) bean:write and bean:message tags. It outputs AMF or XML from any Java object with ActionErrors and transaction token support. FxStruts is present both on the Flex and Java side.

Note: Struts 2 is an entirely different framework and currently not supported by FxStruts.

Flex is a free open source framework for building expressive cross platform web applications, and it comes with tons of customizable and extensible controls. Flex is gaining momentum and many developers are learning how to develop Flex applications with a variety of back-end technologies. If you are a Java developer with some experience in Struts, and you want to get started with Flex quickly, then FxStruts will help you do that.

As a validation of FxStruts, the Struts MailReader demonstration application has been implemented in Flex (see Figure 1) using Cairngorm by only adding new JSPs and changing the struts-config.xml file on the back end. No other changes have been made to the action or validation classes.

fxstruts-mailreader-main.jpg

Figure 1. MailReader demonstration application

In this article, I'll describe some of the JSP tags and features offered by Struts and show how these are preserved even when using Flex courtesy of FxStruts.

I'll also walk through the process of installing FxStruts and writing a simple Hello World Struts web application with a Flex front end.

Requirements

Flex Builder 3

Struts

FxStruts

Sample files:

Prerequisites

  • Working knowledge of Struts.
  • Basic knowledge of Flex.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

About the author

Anirudh Sasikumar is a Technical Evangelist for Flex at Adobe. He enjoys programming and simply can't think of not hacking away at code whether it is in ActionScript, Lisp, C++, or Java. In his spare time, he reads a lot of fantasy books and plays basketball. He confesses weakness for beautiful user interfaces and 3D graphics. Anirudh has a blog at anirudhs.chaosnet.org.