Choosing a Java Web Framework now? [closed]

Solution 1:

Is portal based solution a good fit to this problem?

Personally, I would stay away from big fat Portal solutions (they are often productivity killers). I've heard good things about Gatein though but I don't have any real experience with it.

Any insights on using "Spring Roo" or "Play" will be very helpful.

About Spring Roo, I've read previous answers like Spring roo Vs (Wicket and Spring) and other things over the Internet but I'm still not convinced (maybe I don't get it), I'm not sure of its maturity, and, more important, I'm really wondering what SpringSource is doing with Grails and Roo (no, Grails vs Roo - why SpringSource is pushing two very similar technologies? doesn't convince me that they will both survive).

I can't say much about Play. I've seen the demo like everybody but I would like to read real life feedback. Until then, I'll wait.

I did find similar posts (...). Things have surely changed in the mean time!

Yes and no :) But let's enter the presentation frameworks hell: there is no single answer to your question (like one year ago), there are dozen of frameworks around there and no clear winner. Just to cite a few:

  • JSF: Lots of skeptics about this component based framework, including me so I'm not the best one to talk about it but...
  • JSF 2 (+ CDI/Weld): JSF skeptics are encouraged (by Gavin King) to "take a second look". Indeed, I think that JSF 2 is a big improvement, especially with CDI, but... it is still pretty new (understand, it lacks of feeback). If you want to embrace Java EE 6, check it out though.
  • Wicket: Another component based framework that is getting more an more attention. I hear mostly good things about it: simpler than JSF, nice design, high testability, HTML designer friendly, etc. You may like it.
  • Tapestry: Just don't (see Why did you stop using Tapestry?)
  • Struts 2, Spring MVC, Stripes: Action based frameworks. All decent and will cover your needs (personally, I like Stripes and its convention over configuration approach, see Stripes vs. Struts2 to get an idea of it).
  • GWT, Flex, Grails: These aren't maybe not what you're looking for. I can't really talk about (recent versions) of Flex and GWT but I know that Grails does have some fans.

Actually, I'd suggest to take a look at Matt Raible's presentations, he really did a great job at comparing web frameworks, showing their strengths and weakness, gathering facts and numbers, showing trends... I recommend:

  • Comparing JSF, Spring MVC, Stripes, Struts 2, Tapestry and Wicket (still not obsolete)
  • Web Frameworks of the Future: Flex, GWT, Rails and Grails (just to get a taste of alternatives)
  • Comparing Kick-Ass Web Frameworks (this one is the most recent)

Really, have a look at these presentations, they will help you to find an appropriate framework (there is no unique answer but you can restrict the choice by elimination) and might change your point of view.

Solution 2:

I've been using Spring 3 3 and jQuery for a while, but heard about Play and gave it a shot. I really like it, Play is a great fit between something like PHP and the heavy duty Java frameworks like Spring.

The things I like most about play are:

  • Very easy to get a play application off the ground, you have to go pretty far with coding and configuration to get a simple crud application on the screen with Spring (though Spring 3 has made it a lot easier).
  • Spring Security is awesome but it comes at the cost of complexity. Play's security module is very very simple and covers the needs of probably 90% of applications out there.
  • You can make a code change and hit refresh in the browser to see the change like with PHP instead of having to do the whole redeploy thing with Servlet based frameworks.
  • Error messages are displayed nicely and not so cryptic most of the time. Play still needs to work on their error handling
  • There's a plugin mechanism for Play that's pretty simple.
  • Object persistence is done very nicely in that an in memory database and JPA comes with the framework so there's no configuration of external object persistence tools. Going from the in memory database to an actual RDBMS is a one line change in the configuration file.
  • The MVC setup is done very well. The Model class you extend to create your domain objects integrates with the JPA entity manager. They're not just POJOs.
  • Mapping URLs to controllers is simple and flexible and all in one "routes" file.
  • Whenever you create a project Play handles all the JAR dependencies and Play has a utility to eclipse-ify (or whatever IDE you like) the project so that it imports directly into your favorite IDE.

Things I don't like about Play

  • The documentation isn't all the way there yet, lots of undocumented features still exist.
  • The framework is the server so you have to dedicate a port to each application. I think someone is working on a virtual host plugin, but I haven't seen it in action yet.
  • It's young, the project is awesome and technology is awesome, but it really needs some more developers. I would love to dedicate some time to it, we'll see.

Solution 3:

The top choice for me is Wicket.

It has:

  • Clear separation of markup and Java code.
  • Very easy to write and use components.
  • Simple to use Ajax
  • Testability.

You can debug right into your pages / components and don't get cryptic error messages from your JSF implementation ;)

There is also a good comparison wicket <--> JSF in terms of performance.

Solution 4:

The top three choices for me are (alphabetically):

  • JSF
  • Spring MVC
  • Struts 2

They:

  • have good Ajax support
  • allow you making actual web-sites, not applications (like GWT)
  • stable, well-documented, widely used
  • MVC
  • pure Java
  • easy integration with Spring as middleware