Web 2.0 and Enterprise Java - move over Struts

by Paul Browne

Related link: http://www.firstpartners.net/blog/technology/2006/03/01/web-20-and-enterprise-ja…

A while back I wrote an article for an O'Reilly sister site, Java.net , on Sprinkle Some Ajax Magic into your Struts Web Application. I'm going to repeat one thing I said in this article: while coding Ajax is cool, you really want to use a framework if you have the choice. If you don't believe me , check out some of the podcasts on Ajaxian.com. When you listen to the problems that the Ajax frameworks have overcome (What if the ActiveX XmlHttpRequest Object is turned off? What if you want to do local storage? What if the user hits the back button?), you'll be a convert to the 'Frameworks are better' approach. So which Ajax enabled framework should you use as an Enterprise Java developer?

Pre Ajax, the answer to 'which Java presentation framework should I use?' would have been Apache Struts. Not because it was technically better than any of the other frameworks (although feel free to leave your comment!) but because everybody else is using it. This meant
(a) using Struts is good for your client, as they can replace you if you get run over by a bus and
(b) using Struts is good for you, as you can take your Struts skills to your next piece of work.

However , in this strange new Ajax and Web 2.0 world, things are beginning to change. Javascript gone from 'has been kiddie scripting language' to 'coolest thing on the planet'. User expectations about what Enterprise Web applications can are going through the roof as Web 2.0 enters the mainstream. What Java framework are you going to use to deliver these expectations?

With this in mind, I did some research on the Ajax Enabled Java frameworks that are currently (Feb 06) available. I tried to pick out the best ones (best for your career, and hopefully technically best) based on the following criteria:

  • Java - Web development frameworks with Ajax capability.

  • Rating based on technical capabilites, and which is most likely to be the 'next Struts' (i.e. become the defacto standard for Java-Web Development).

  • Rating is based partly on downloading and running the projects and partly on evaluation of what the websites / other people say.

  • Products must be available (at least partly) in open source form with a recognised open source licence - as these are most likely to get community traction.

Before we get into the list, there a couple of items that you may think are missing:

  • Whatever you may think of non-Java frameworks (e.g. Ruby on Rails, PHP with Ajax), these are not included here. The notion of Java being replaced by Language / Framework 'X' is an entirely different article.
  • The list also does not include several excellent 'server neutral' frameworks such as BackBase, Dojo, Prototype, or JSON. While these frameworks are included with some of the toolsets listed below, we're aiming to get an 'out of the box' toolkit for the Web tier of Enterprise Java applications.

  • You'll also probably note that there are 3 implementations of the Java Server Faces (JSF) standard on this list - MyFaces , Ajax JSF and Struts (Shale).

Think I got the evaluation wrong? Leave your comments at the bottom of this post.

Ajax Java Web Presentation Frameworks

AjaxAnywhere Independent of Java framework (e.g. Struts, JSF or Spring). Closest in approach to Java.net Struts-Ajax Article. Good interim solution based on existing frameworks, but can't see this being the main framework long term.
Apache Myfaces Apache implementation of JSF, including technology donated by Oracle from ADF / Oracle Fusion. Being Apache, will become one of the main JSF implementations in use. But is JSF the best way of doing your website?
App Fusecombines a lot of the leading frameworks (Struts, Dwr, Spring with JSF as an option) into one easy to use package. Already a very good ready to go package (for web , mid and business tiers) and the Appfuse team have a good track record in integrating the latest, most widely used frameworks.
Ajax JSFAjax implementation of the Java Server Faces Specification. Good indication of what a full JSF Ajax implemention would be like, but implemented by only one brave developer!
Echo 2Evolution of original Echo Framework, can run in any Servlet container. Original has cult following, but doubt if it will become the number 1 web framework.
DWR - Direct Web Remoting Acts as a proxy so that you can call Java Objects transparently from Javascript. Good solution, seems to have traction, even though it still forces you to write Javascript and keep objects in Synch with Java. Several other frameworks (e.g. Appfuse and Webwork (soon to be in Struts) integrate this.
JSP ControlsAims to be drop in (Ajax enabled) replacement for JSP Tags. Can be used both with simple JSP and other frameworks, but at the time of writing has less than 1000 downloads
JWIC Dynamically add Ajax to Java class based application - similar to Velocity concepts. A good simple framework, based on POJO's but doesn't (yet) seem to have much traction on sourceforge.
StrutsThe original, and to many, still the best. Many changes are afoot in the next version, including the integation with WebWork (which already has Ajax capabilities) and the move to the JSF compatible ('Shale') Struts aims to be backwards compatible, and the forthcoming JSF and Ajax capabilities look good. Pity there is no 'offical' milestone release yet.
Struts LayoutStruts Tags, but with Ajax capabilities. Another good interim solution based on Struts, but is the Struts Event model suited for the Ajax world? (e.g. multiple events being raised from the ajax web page, instead of just the one (GET or POST) in the standard HTML model)
Swato Integration with Java Servlets through use of Servlet filters.Not a lot of documentation, nor a demo to encourage me to invest more time in it.
Tacosaimed at providing Ajax for Tapestry
Tapestry is technically a good framework, just didn't seem to get the traction Struts did. Not sure if adding Ajax is going to change that.
WebworkWill integrate with next version of Struts (as Model - called the 'struts action framework'). Strong contender, gives Ajax functionality through (integrated) DWR and Dojo.
WidgetDev Hybrid (Open-source/ commercial) Framework. (In my opinion) Not enough maturity / features to justify open source version with reduced features
zk8XUL / XAML type framework , capable of being rendered in either Swing or HTMLGood Framework, might attract people who are familiar with extending Firefox using XUL, but can't see XUL (no matter who much I think it is a good idea) being mainstream without a visual designer.

The New Struts is .... Struts. Some other framework may overtake Struts to become the new standard, but I would recommend the following Struts-related frameworks based on the following scenarios

Scenario 1: Adding Ajax to existing Struts Applications. Use AjaxAnywhere - closest to the approach taken in the article Sprinkle Some Ajax Magic into your Struts Web Application. Despite writing this article , I see the frameworks evolving rapidly to the point where you would only take such an approach for adding Ajax to 'Legacy' applications.

Scenario 2: Need Ajax Now for a new Java Application. Use Appfuse as it gives Struts, Ajax (with DWR) and the possiblity of JSF integration now, all 'out of the box'. This fits in well with ...

Scenario 3: Medium Term. Use an implementation of JSF (either MyFaces or whatever Appfuse promotes - probably Struts Shale). Struts Shale (JSF) has so far released only 'overnight' builds. Apache MyFaces (JSF) tool support and Ajax capabilities are likely to improve over time. Both Struts-Shale and MyFaces are likely to play well with AppFuse , making it a safe bet for investing your time checking it out.

Think I got the evaluation wrong? Leave your comments at the bottom of this post.


2006-03-01 06:49:14
I liked the title
Just from the title I thought you'd take the discussion in a different direction. Both you and Jacob Hookom are discussing AJAX support from JSF or some other framework. AJAX doesn't really need integration with server side component frameworks (struts, jstl, JSF). The best AJAX frameworks work with PHP, perl, or Java...in other words, they don't need struts or JSP or tags. Normally they just need a data service. Thatís why I find it a little funny when NetBeans comes out with AJAX supportÖwhat once was a nicely independent piece that a designer could perhaps use must be bound and tightly coupled back into the J2EE stack. Actually, it seems that AJAX might make it less necessary to even use JSF. The page designer develops a more robust interface, and tells the server side developer "hey I need you to send me a list of 'X', can you provide a service for that?"

2006-03-01 07:30:43
Users don't care about Ajax
Users don't care about Ajax - or at least by 2007 , once the buzz around 'look at the cool new things we can do', they won't. What they will care about is 'does this application help me / my business?' and 'is it easy to use?'.

This is a roundabout way of replying to your comment.

One one hand , you don't need JSF , Struts or a server side framework to use Ajax. In fact , you don't even need an Ajax library - you can just go ahead and code it yourself in javascript.

On the other other hand (Enterprise) developers have long moved past the 'code everything yourself' stage. It's nice to know that you can , but mostly you want a framework that does 80% of the donkey work for you (Database calls, Mid Tier remoting, Web presentation and workflow) while you concentrate on the 20% that the customer really appreciates.

So, while the focus is at the moment on cool standalone Ajax frameworks (and I have a lot of respect for the work those guys are doing), I think frameworks are going to evolve further in the Java space. At a minimum , we'll see a Web presentation framework , that gives Ajax 'for free' as no big deal. Some developers will prefer an 'everything there out of the box' solution like Appfuse, containing best practice Web , inversion of control and persistence frameworks.

This blog post was all about guessing which framework will become dominant, and then learning those skills as a good career move!

2006-03-02 12:26:49
tcowan I'd have to disagree
Speaking as someone who has done both: 1.) integrated AJAX into a server framework that had no built in support, and 2.) Used a framework that has considered the requirements of AJAX up front, I'd have to wholeheartedly agree with Paul on this. It is much easier to implement a site using AJAX if your server-side framework provides hooks and helpers. AJAX isn't just something a designer can slap on an app as an afterthought.
Jep Castelein - Backbase
2006-03-09 11:26:50
I agree with Paul and tmo9d: at Backbase we've heard many requests for server-side integration, and therefore we've developed the Java Server Edition, which is based on JSF. It also supports single-page interfaces (versus the traditional multipage web apps). The Java Edition will be launched shortly, and a preview version is available for qualified prospects.
Paul Browne
2006-03-09 12:28:50

Do you know where I can sign up for a preview of the Backbase JSF preview?



2006-03-12 03:26:01
Java and JSP is a perfect platform to build Ajax applications cheaper and better. For example look at a recent announcement from a startup, which demonstrated reusable Ajax GUI Components for JSP.





Using the simple process outlined in the web site any programmer can create better reusable Java GUI Classes for Ajax components. The GUI Classes can be more flexible and easy to integrate, than the Classes in GUI API for Windows/VB. The Java GUI Classes can be used in JSP to generate graphics intensive applications (web sites).

What will stop any one from building the great Ajax applications? The process out lined in the web site is simple even to doubt if it works. Try it out and build your own Reusable Ajax Widget.

This is just the beginning and every one knows that there are many others hard at work and still in stealth mode. It is still too early to know, since Ajax became popular only in the past few months. It takes time even for real innovations to mature.

2006-03-17 10:32:37
I've used Apache Cocoon for the Ajax endpoints on http://www.stylefeeder.com/ and I have to say that I'm really pleased with the results. Cocoon's flexibility to slice and dice XML is exceptional. I find that when I'm dealing with XML, I tend to want to be using Cocoon. When I'm dealing with objects in a situation where I'm passing objects through the MVC layer cake to jsp pages (still the best way to push out HTML-based UIs), I tend to want to be using Struts.

Check out Cocoon and Flow to get a sense of how easily it works with the client-side framworks.

2006-03-27 14:43:28
The Backbase JSF extensions seem to be headed in the right direction, i.e. easing the development of single page component-based apps while still providing some support for what will likely become legacy multi-page apps.

I'm not sure I agree with Paul's description of Echo2 as having just a cult following (see http://blogs.pathf.com/agileajax/2006/03/echo2_a_cult.html). What was a bad idea before Ajax has become a good idea afterwards.

2006-05-06 16:20:20
Hey Paul,

I too am a struts favoring developer.. and since from your research, there is no confirmed official struts release with ajax capabilities yet, can you suggest me a framework to get hands on experience on, as a substitute, till then..

Thank you

Paul Browne
2006-05-07 02:44:05
At the moment I'm playing with Direct Web Remoting (DWR), and so far I like what I see. My previous concerns (around Security) seem to have been addressed by new releases. I also like the fact that it plays well with both Struts and JSF (Java Server Faces). It's also getting a lot of attention within these communities , making it a good bet for future mindshare.
Robin Sharma
2006-05-09 02:20:03
Hi Paul!
Have you heard about this new framework called Wicket. If yes, then do you think it fits into the Web 2.0 scenario.

Paul Browne
2006-05-09 05:41:15

I haven't yet used Wicket , but somebody whose opinion I value recommends it hightly. From my understanding , it appears almost Ruby-like in that it aims to make common things easy.


Kito D. Mann
2006-06-12 09:01:38
Paul, I think you're missing one key thing with JSF here: it doesn't matter whether you use MyFaces or the JSF RI -- the framework fully supports AJAX. (JSF 1.2 does improve the support, however).

So, the key thing is this: pick JSF components that provide AJAX behavior. And, just about every set of JSF components offer AJAX support at some level (see JSF Central's Component Directory for a list). The benefit is that you can use a standard, easy-to-use programming model and avoid worrying about JavaScript and DHTML altogether.

Another key point is that "Ajax JSF" isn't a JSF implementation at all; it just makes it easy to add AJAX support to existing JSF components. As a matter of fact, that project has evolved into the Ajax4Jsf project recently open sourced by Exadel. With it, you can easily add AJAX to any JSF application even if the components weren't written to support AJAX. That's the power of JSF :-).

Kito D. Mann
Author, JavaServer Faces in Action
Virtua, Inc. - JSF/J2EE consulting, training, and mentoring
JSF Central - JavaServer Faces FAQ, news, and info

Paul Browne
2006-06-12 09:11:51

Thanks for your comments - I wasn't aware that things had moved so fast on the JSF-Ajax side of things.

Speaking as somebody who has done a little bit of JSF but a lot of Ajax, what JSF components would you recommend that come 'Ajax ready'?

The general aim of the blogpost is 'Web frameworks is in a time of change, will something replace Struts?'. I'm a mercenary consultant - I want to know what my clients will be looking for :-)

Paul , Technology in Plain English