Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News FXStruts: Developing Flex-Friendly Struts Application

FXStruts: Developing Flex-Friendly Struts Application

This item in japanese

Struts is a Java framework based on standard Java technologies, such as Java Servlet, JavaBean, ResourceBundles and XML. Java developers have been enjoying Struts as a solid server side framework for many years. Recently, a technical evangelist for Adobe Systems, Anirudh Sasikumar, developed a new solution by integrating Flex as Struts' front end. Sasikumar calls it FxStruts.

According to Sasikumar:

FxStruts is a free open source library that provides the same functionality as bean:write except that the output is in AMF or XML format. Simply point it to any plain Java object and you get Flex friendly AMF or XML output with ActionErrors and transaction token support.

Sasikumar was motivated to develop FxStruts, owing to the complexity involved in developing Web applications. He notes:

Web application development is tricky business. You start off with simple JSPs and after a while your Web application is tag soup: a mix mash of JSP tags, HTML markup and server side code. You slowly realize there has to be a cleaner way of doing this. This is where you finally read about MVC, Struts, Spring, and so fort and get blown away!

FxStruts is created to solve a problem that arises when you switch the MVC application's view to Flex. As Saikumark says, “Once you change your view layer to Flex, it is harder to get data from your model while using Struts. FxStruts was developed to make this part really easy.

Saikumark demonstrates FxStruts with a Struts MailReader application that has been modified to have a Flex user interface (UI) without any changes to the Action classes. The only changes made were the addition of new JSPs and the mappings in struts-config.xml.

For people interested in FxStruts, it is hosted on Google Code and has two pieces: the taglib piece licensed under the ASL 2.0 and the AMF / XML serialization part1 licensed under the LGPL 3.0. The Flex component, HTTPAMFService, is licensed under the MPL 1.1.

The Flex version of the struts mailreader application (WAR) is available at Google Code along with a walking tour, highlighting the steps involved in developing a full-fledged Flex application on top of Struts. Documentation on installation and how to migrate an existing Struts application to Flex is also available.

Rate this Article