Apache Struts is the most popular Java web application framework till date. However, newer developments have rendered it both obsolete and inadequate. There are a few options that are trying to replace it but there is no clear winner yet! Who do you think is leading and worthy of the position? Which framework should you use today if you are a Java web application developer?

Rich application development technologies, AJAX, RIA or whatever other form that they may manifest in, are currently the most popular web UI technologies. However, Java is still the choice at the server side. Because of this some of the server side UI technologies, based on JSP and JavaServlets, are still prevelant. Many times these server side UI technologies work in association with the rich UI technologies. As an example many developers are incorporating AJAX with Java Server Faces (JSF), the new generation server centric web framework specification from Java. Many others are using Java remoting libraries, open source and commercial, to remote JavaScript and ActionScript calls down to the server side.

Does that mean we should adopt one of the frameworks like Apache Shale that work well with JSF? Does it mean we should use a remoting library with Servlets only, as far as the Java part of the web application goes? Or does it mean we should use a framework that does both - i.e. JBoss Seam?

Before we answer these questions, let’s take a quick diversion to understand what Sun is saying. Unfortunately Sun has no clear message at this time. It has three strategies and it is saying all three of them at the same time. These are :
1. JSF - server side component based specification that enhances the earlier Servlets and JSF model
2. Swing - VM based solution for the web. Should have been a leader of the rich age since it started things 10 years back but unfortunately is a laggard. Seems like Swing Application Framework is touted as a savior to revive adoption of Swing. I don’t think its going to cut much ice.
3. JavaFX - its all news and little real option yet. This is the answer to the rich web frameworks. It encompasses the mobile, the web and the desktop interfaces. Time will only tell what becomes of it! My opinion is that Sun excited developers much too early. So by the time developers are disappointed and leave the camp, it may actually be a fantastic option.

Now that we have this information or should I say confusing direction from Sun, what should we choose as the web application technology. My opinion is that Swing is a lost battle (technology may be great but too much work will have to be done to change the impression) and JavaFX is just a promise at this stage and its real character will not become evident in a long time. Therefore, the only viable option is JSF. Now JSF has its own set of problems but usage of frameworks like Seam and inclusion of AJAX enabled components like ICEfaces may be a good choice. Further, with frameworks like Seam you are not tied to JSF and could use it to even remote pure JavaScript (like DojoToolkit) or Adobe Flex applications to server side Java. Two more things, JSF2.0 and JavaServlets3.0 are coming. Both have great improvements, which I will talk about in another post I guess. You can always lookup the details on the respective jsr sites.

Before we close and somewhat pass a judgement that use Seam as the framework of choice, there are two more options to consider - the web framework from Spring and the Google Web Toolkit. Spring is a great choice if you already use a Spring server side, everybody in your team knows the spring framework well. However, Spring deviates from the standard JavaEE in many ways and I would suggest sticking to the standards. Interestingly Seam can work with Spring and Spring beans can be used as Seam components. Google Web Toolkit on the other hand is a fancy tool that appeases Java developers by translating their code to JavaScript. It comes from what I would like to call the “Technology Rock Stars” so it attracts developers. It is seeing a decent adoption. However, its not a complete web framework. Interestingly, it can work with Seam. So I can’t think of anything better than Seam today.

JBoss Seam may not be the 100% answer and may not reach the level of adoption that Apache Struts did, but its winning the current round and is certain to lead the way unless newer options arise.

I am personally interested in JBoss Seam and am so inspired that I have presented on the topic at a few Java user groups. I am also writing a book on the topic. However, I am not trying to evangelize here though and would be happy to know of alternatives and discuss why those may be better and worse than what I propose.