What is The Best Java Web Framework?

What is the best Java web framework

No, really, what is it? Are you one of those people who ever wondered why there is actually more than one? Or you work with Struts for 5 years in a row, and think it is the best, just because you know all the nasty hooks you have to implement to make it do what you actually need?

Are you one of those die hard Rails fans, who (as most of Rails developers) does not really know Java, but already has a lot to say how bad it is?

Do you work in C++, and feel absolutely confident, that the framework, your company had developed for the last 25 years, that build web pages via socket programming is the best, and the most efficient one out there?

Is your company big enough, so it has a mature team of software (what they call themselves) architects, that take open source frameworks, and write their own single wrapper framework around it that, as they think (since they wrote it), is the 8th wonder of the (ancient) world?

You, see, I am a consultant – I know many of you, since I met “you” before :)

This one will be a very short article about my experiences with several Java Web Frameworks out there. Here we go:

Spring MVC Would be a good choice for the most of your needs

(I’ll give a short controller example below)

Wicket Interesting to look at – no XML, no JSP (JSTL), just Java and HTML. Can mimic a flow in a WebPage object. Better separation of concerns than, for example, in GWT (e.g. no Javish CSS, etc.). Good Community

The only thing that is off is your dynamic HTML elements are done in Java

Spring Webflow Yes – it is a separate beast. It mostly is good, and makes sense, however, in practice, once you need to do something a bit more complex that a shopping cart or a hotel booking app (hint, hint), you can run into problems. “Back button” and “Double click” are not very well handled by the framework, may get an exception while bookmarking (there is a magic recipe, but far from being simple, and intuitive), sharing data across the flow, last resort error handling are not simple, etc.
Stripes Good / simple (no XML – conventions), but not very actively maintained – hence not as mature. (good community though) Worth to look at for simple projects.
Struts Just architected wrong from the very beginning: Validation (XML – why? What about minimum search criteria, what about several, what about nested OO validators!?) / 0 for NULLs / Multi Action Forms / Testing (without StrutsTestcase) / etc. ) Improved a bit since WebWork merging, but still lots of “code smells”.
JSF Quite hard to keep up with all these JSF based JSP tags + integration with security is not simple + full JSF solutions are usually Frankensteins with many pieces from different vendors.
Tapestry Not bad, actually make sense, when you get it. But have you ever looked and tried to follow the Tapestry code? – Very complex implementation, if ever need to look inside the code + Tapestry does take time to learn, so forget about a new off-shore team, or fresh out of college not so geeky grads, taking it on.

And here is why I like Spring MVC:

  • Binding / Validation is done just right – clean, testable, reusable
  • Multiple View options ( PDF, XML, Excel, Atom, etc… ) done easy [AbstractExcelView, AbstractFeedView, AbstractJExcelView, AbstractPdfView, AbstractUrlBasedView, AbstractXsltView ]
  • Annotation based – no XML madness, and very clear when looking at the code – check the Pet Clinic in Spring 3.0 M3
  • Integrates with Spring JS very nicely ( in case needed )
  • Handing requests and parameters with ( Spring ) expression language – quite flexible
  • In Spring 3, MVC is actually REST aware (GET, POST, PUT, DELETE)

You can download Spring STS, import sample projects, and see many examples on how to use it, but here is a very simple controller example from Spring’s Pet Clinic:

@Controller                                                 // it’s a controller
public class ClinicController {
      @RequestMapping("/welcome.do")           // that all there is to mapping
      public void welcomeHandler() {
      /** @return a ModelMap with the model attributes for the view
                                 uses org.springframework.core.Conventions */
      public ModelMap vetsHandler() {
            return new ModelMap(this.clinic.getVets());
      public ModelMap ownerHandler(@RequestParam("ownerId") int ownerId) {  // parameters are passed in easily
            return new ModelMap(this.clinic.loadOwner(ownerId));

It all depends on project’s requirements / timeline / resources / requirements / technologies already in place / etc… But having a choice, I do choose Spring MVC – it just makes sense: easy implementaion with Spring Roo / integration with Spring’s back end / support / community / releases / etc… I also like where Wicket is going, but it feels like “it is still going…”

In any case – good luck, and remember – if it does not have to be Java, but you still like to “stay close”, I would definitely give Grails a shot.


  1. Nice to hear you voice, Toly.

    But “Spring Presentation Layer” is not even component oriented. Essentially it is a pretty empty thing specifically in View part. Otherwise why would it appeal to using Velocity etc?

  2. @Alex,

    Spring MVC can be directly compared to Wicket, as they both solve the same problem of connecting domain (M) to the view (V) through a medium (C). Wicket has more of an MVP approach than MVC, but still solves the same problem.

    If you are building a “web app”, and it does not have to be Java, I would not even bother with Spring MVC directly, as there are tons of simpler alternatives ( Sinatra, Django, Webmachine, etc.. ). But if the language of your/your project’s choice is Java, which is a great language by the way, then Spring MVC is just a natural choice for an MVC like simple web app.


  3. Did I tell that Wicket can not be directly compared to Spring? The previous 52 messages have disappeared from your page. We can. They both solve the same problem, you are right. But Wicket is a component-oriented framework and Spring MVC is not and that impacts its value very much.

  4. HybridJava version 1.05 released. Component-oriented support for Ajax added.

  5. Good catch, the best is the one that suits you

  6. @eric – what is this comment about?

  7. @Alex,

    Yes, you said that: “It is not right to take Wicket and Spring as alternatives. Wicket is practically about presentation layer. Spring is valued for its IoC that belongs to business layer. On the other hand in presentation domain Spring by itself is just nothing.”

    There is an “Older Comments” button right under the last comment. Comments paginate after 50 somm.

    Happy Halloween,

  8. I created the hamlets framework to develop websites in a very short time. It is a Java framework, easy to use, and easy to understand (in 20 min.). You can leverage your Java skills and your Java libs. Enjoy!

  9. @Toly We can compare Wicket an Spring because there is something in common. We may not consider Wicket as an alternative to Spring because Spring covers more things. If you drop Spring and use Wicket in your development then you will most probably have to involve some more solutions to substitute Spring.

    I liked the joke about Hamlets framework. Read more at http://hamlets.sourceforge.net/

    Let the halloween go to hell where it belongs. My church does not approve it.

  10. @Alex,

    Notice that I compare Wicket to Spring MVC, and not to the whole Spring Zoo.

    As to Halloween, it is a holiday, where people wear costumes and party a lot, which is a lot of fun => don’t be hatin, participatin :)


  11. Comparing Wicket to Spring MVC is OK. Spring MVC is not component-oriented. Wicket is component-oriented.

  12. HybridJava version 1.06 available

  13. All the framework you cited are MVC framework, so really there is not a big difference between them. The problem of MVC framework is that they are not very productive, because you have to write a lot of code for several layers. This is very important when you develop business applications, with many many pages, tables, business logic, etc.
    An alternative to the MVC frameworks are the Domain-Driven framework. Java has a lot of them, such as OpenXava, NakedObjects, Roma Framework, JMetter, Tynamo, etc.
    You can have a look to OpenXava:
    A Java Web Framework that is not MVC.

  14. Javier!

    “All the framework you cited are MVC framework”.

    That was the topic. OpenXava is not an alternative to those MVC frameworks discussed. They are all server-side frameworks. What happens on the client is a different story and often complex applications use some framework for the server side front, some other on the client, yet another for data access layer and so on. They do not interfere much.

    Those who tell you that they have an end-to-end solution indeed have that, but that is usually a set of unrelated techniques and the simply are trying to sell all (good and not so good) in one package.

tell me something...
  1. (required)
  2. (valid email - optional)
  3. Captcha
  4. (required)