Posts Tagged: Java web frameworks


15
Oct 10

The Best Web Framework for Java

This post is a duplicate of my answer to a Sergei Batiuk’s question in the Java EE Professionals discussion group on LinkedIn. The question was “Which Web Framework for Java do you find to be the best?”, namely:

“After years of development in Java, including web development, I find it hard to find a perfect web framework, while there are a lot of them out there.

The common problems are:
1. Most of them can be configured only by XML, but sometimes or most of the time I need to configure them programmatically;
2. The URLs they produce are not nice. http://website.com/index.faces, http://website.com/index.action – are you kidding me? URLs are very important when it comes to SEO;
3. The workflow model is typically inefficient;
4. Modularization is typically compromised. You cannot, for example, package JSPs into jars to distribute as modules because all JSPs must be withing the root of a web application.

The list can go on and on… What do you think about it? Is there a web framework the works perfectly for you?”


So, to make it closer to the point I’ll give you my opinion specifically in terms of web frameworks (front-end), and not data access/infrastructure/etc aspects.

Preference: from my recent experience, I would support votes for Grails, which allows you to virtually forget about configuration burden and to implement simple to fairly complex things in a very simple way.

Regarding the mentioned weak points:

* 1), 2) and 4) are pretty much supported by major web frameworks – so I can’t really see a problem here;

* 3) for workflow type web applications – Spring WebFlow is something really worth to look at (it can be married with major MVC frameworks easily) – I had very positive experience with it in a previous project. However, to answer this point appropriately, Sergei, could you please explain what you mean by “inefficient workflow model”?

Answering “Is there a web framework the works perfectly for you?”, as there’s no single remedy for every case, I would identify three major types of web-applications and appropriate framework types accordingly:

1. For intranet sufficiently massive enterprise applications with advanced data management requirements (in this case, normally standard look&feel tends to persist through the whole application) – component-based frameworks is my choice

* e.g., GWT, JFS implementations, wingS framework (the latter is quite interesting and good try to imitate Swing in the web – I used to love Swing model – though I’m not sure about the project’s current status, the latest version is dated to 2008-04)

(I’m not much experienced with RCPs like Flex, but my level of familiarization with them lets me identify them as suitable into this category, too)

2. For Internet fancy looking applications – combination of MVC + template-based + javascript solutions.

* e.g., Grails (gsp is pretty much similar to jsp, not by sounding only :) ), Spring MVC, Struts 2 + Freemarker, Velocity, Sitemesh, JSTL + jquery, yui, jprototype – whichever you are most experienced with or give your personal preference to.

3. Small few-purpose applications aimed at solving existing temporary problems quickly – you basically don’t need any framework, go with plain old (and dirty) jsp! :) … or if you have experience with, make quick consideration of Grails / Spring MVC. :)

I hope, this, despite quite high level, overview sheds some light on the problem.