InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Phil Zoio Discusses Bringing Java 5 Features to Struts with Strecks 1.0

Posted by Scott Delap on Oct 31, 2006

Sections
Development
Topics
Web Frameworks ,
Java
Tags
Struts ,
Strecks
Strecks version 1.0 was recently released. Strecks is a set of Java 5 specific extensions to the original Struts framework. Making heavy use of Java 5 annotations, it adds a number of modern features to Struts-based applications, including POJO actions, dependency injection, declarative validation and data binding, interceptors, pluggable views, as well as Spring integration.

The aim of Strecks is address perceived inadequacies of the original Struts programming model while still allowing full backward compatibility of applications. Strecks works with the most recent general availability Struts versions (1.2.8 and 1.3.5), but at the same time allows developers to work with advanced features expected from modern web frameworks. Strecks is aimed at developers who:

  • have a significant existing investment in the current version of Struts, either in terms of knowledge or existing code
  • are not currently ready or willing to take the pain of migrating to the forthcoming Struts 2.0 (based on WebWork) or another web framework
  • want to take advantage of advanced features not available in vanilla Struts but increasingly so in other frameworks

InfoQ sat down with Strecks lead Phil Zoio to discuss the new project. First Zoio described the motivation for Strecks:

I was commissioned to work on a new project around August last year, and did not have a choice on the web framework, as it was mandated to be in Struts. Struts would not have been my choice at the time, so over the course of the project I added a few extensions which made the framework easier and more productive for me to use. After the project was complete, I decided to invest some effort into reworking these changes into something which I felt would be helpful for other developers in the same position as I was. In the process, I've also added a couple features which I don't think are present in any other mainstream framework. One example is the ability to extract common presentation logic into reusable action controllers, and another the ability to add enhancements using annotations which are fully self-describing.
Zoio was then asked about the difficulties in bringing Java 5 support to Struts:

Quite a few things helped make the task easier. First, because Struts is quite a simple layer over basic Servlet/JSP dispatch model, I still had quite a few degrees of freedom to work with in adding functionality without ending up with anything overly complex. Secondly, by targeting JDK 5 only and making heavy use of annotations, Strecks takes advantage of opportunities for productivity gains not fully exhausted by Struts or other frameworks targeting a wider range of JDK versions. I've had to accept a few limitations in the framework imposed by the original Struts implementation choices, but some restrictions were easier to overturn. The best example is the requirement that a Struts action instance should be shared by multiple threads and not store request-specific state. Removing this restriction from Strecks opened up possibilities for dependency injection and a generally simpler action programming model.

Struts certainly needed some fairly radical changes to bring it more up to date. I'm not convinced, however, that the change they did eventually go for - adopting the WebWork code base - was either necessary or in the interests of the Struts or WebWork user communities as a whole.

Strecks extends the life of Struts by adding many Java 5 features developers have been wanting. Zoio was asked about where he sees Struts going in the years to come in comparison to the rise of Ajax and frameworks such as GWT:

Its very difficult to say. The key question over the next few years is whether pure Ajax frameworks or frameworks which contain a mixture of "traditional" elements enhanced by Ajax will come to dominate web application development. The purpose of traditional web frameworks in the pre-Ajax world is to allow for coherent, maintainable web applications, but the jury is still out as to whether these are fundamentally equipped to allow for coherent, maintainable web applications primarily based on Ajax functionality. The current generation of frameworks can handle small enhancements easily enough (e.g. auto suggest, dynamic drop downs, etc.). However, projects with ambitious interactivity requirements and bigger budgets will inevitable lean towards the use of pure Ajax style frameworks, and in these cases, frameworks such as Struts may be relegated at best to a supporting role. The challenge for frameworks like Struts will be to increase the range of common Ajax-style requirements they can easily accomodate. They need to find the right ways to add Ajax functionality, so that these additions don't just feel like "bolt ons" which don't add much real value over simply using Ajax libraries side-by-side and independently. The better they are able to do this, the greater is the range of projects in the future for which they will still be suitable. Although Strecks hasn't yet tackled Ajax, it is still quite well positioned in this respect, because Ajax type functionality (e.g. integration with tools like DWR) can be elegantly slotted in using custom action controllers, with application-specific hooks available to the action bean classes via annotations.

Pre-Ajax frameworks still have real advantages, not least of which is that they are well understood and simple to use. For as long as there is a spectrum of requirements, ranging from simple to highly interactive, I think there is plenty of room for both types of frameworks, and I expect this to be the case for the forseeable future.

No comments

Watch Thread Reply

Educational Content

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.

Beauty Is in the Eye of the Beholder

Alex Papadimoulis discusses ugly code, where it comes from, how to avoid it, and how to get rid of it.

Architecting Visa for Massive Scale and Continuous Innovation

John Davies examines Visa’s architecture and shows how enterprises have architected complex integrations incorporating Hadoop, memcached, Ruby on Rails, and others to deliver innovative solutions.

Max Protect: Scalability and Caching at ESPN.com

Sean Comerford unveils ESPN.com’s architecture, what components are used and why, and the current changes the website goes through.

The Seven Deadly Sins of Enterprise Agile Adoption

Are there repeated patterns of failure on Enterprise Agile Enablement efforts? Sanjiv and Arlen discuss Seven Deadly Sins to avoid when adopting Agile in an enterprise.

Questions for an Enterprise Architect

Erik Dörnenburg answers: What is Enterprise and Evolutionary Architecture?, discussing 4 issues: Turning strategy into execution, Ensuring conformance, Where do the architects sit? Buying or building?

Wrap Your SQL Head Around Riak MapReduce

Sean Cribbs explains what Map-Reduce and Riak are, why and how to use Map-Reduce with Riak, and how to convert SQL queries into their Map-Reduce equivalents.