InfoQ

News

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

Posted by Scott Delap on Oct 31, 2006 11:03 AM

Community
Java
Topics
Web Frameworks
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.

1 comment

Reply

thanks by ugr ony Posted Jun 30, 2008 8:36 AM
  1. Back to top

    thanks

    Jun 30, 2008 8:36 AM by ugr ony

Exclusive Content

Rationalizing the Presentation Tier

Thin client paradigm characterized by web applications is a kludge that needs to be repudiated. Old compromises are no longer needed and it's time to move the presentation tier to where it belongs.

Agile Project Management: Lessons Learned at Google

In this presentation filmed during QCon 2007, Jeff Sutherland, the creator of Scrum, talks about his visit at Google to do an analysis of Google's first implementation of Scrum.

AtomServer – The Power of Publishing for Data Distribution

In this article, Bryon Jacob and Chris Berry introduce AtomServer, their implementation of a full-fledged Atom Store based on Apache Abdera, which is now available as open source.

An Introduction to Virtualization

It is easy to think that virtualization applies only to servers. In reality the recent resurgence of the concept is also being applied to networking, storage, and application infrastructure.

REST Anti-Patterns

In this article, Stefan Tilkov explains some of the most common anti-patterns found in applications that claim to follow a "RESTful" design and suggests ways to avoid them.

Choosing between Routing and Orchestration in an ESB

In this article, Adrien Louis and Marc Dutoo discuss the differences and relative merits of using orchestration vs. routing in a typical ESB setup, and discuss various implementation options.

Enterprise Batch Processing with Spring

Wayne Lund discusses batch processing, Spring Batch objectives and features, scenarios for usage, Spring Batch architecture, scaling, example code, failures and retrying, and the future roadmap.

User Story Estimation Techniques

Developer Jay Fields draws on his experiences as a ThoughtWorks consultant to describe effective user story estimation techniques.