views:

6302

answers:

24

I am considering creating my own website using Java and am trying to decide what framework to use. However, doing a quick search for Java frameworks returns more than 50 to choose from! My website is just going to be for my own enjoyment of building it in the beginning, but if it becomes popular it would be good for it to have some scalability, or to at least be able to redesign for that. Of the more common frameworks, what are the main differences between them, and are there instances where one significantly outperforms? For example, high-traffic enterprise applications versus low-traffic small applications. I'm also wondering if some are much easier to learn and use than others. Does anyone have any experience with some of these frameworks and is able to make a recommendation, or does the sheer number of choices just serve as an early warning to avoid java-based web development if possible?

+6  A: 

Disclamer: I work at IT Mill as a programmer

If you are doing something RIAish, you might want to take look at IT Mill Toolkit. It's an open source UI-oriented AJAX framework that, to me, is nice to use (I come from a PHP background myself).

There's a case study that compares doing the same application (i.e. two applications with the same set of features) in Icefaces and IT Mill Toolkit. In a nutshell, it states that the UI development was considerably faster.

Even though the study is hosted at the company's wiki, I can assure that it's objective, genuine and truthful, although I can't force you in believing me.

Henrik Paul
+3  A: 

I think for your modest requirements, you just need to code up servlets or simple jsp pages that you can serve from Tomcat server. I dont think you need any kind of web-framework (like struts) for personal web-site data

+28  A: 

My favorite is the Spring Framework. With 2.5 Spring MVC is soooo kick ass, with new annotations, convention over configuration features, etc.

If you're just doing something super simple you could also just try using the regular Servlet API and not bother with a framework.

bpapa
Up vote for mentioning using regular Servlet API for something simple.
lsiu
I would avoid any 'web mvc' framework, for reasons outlined in the (free) first chapter of Wicket In Action. Also, I would avoid using the Servlet API directly unless you have a single page application or you are looking to write your own framework from scratch.
Eelco
I like Spring too, but I found all the configuration only pays off if you are writing a mahoosive application.
Lenni
There is barely any configuration using annotations.
bpapa
+3  A: 

I've heard good things about the Spring Framework too. In general, though, I've been underwhelmed by most Java web frameworks I've looked at (esp Struts).

For a simple app I'd definitely consider using "raw" servlets and JSPs and not worry about adopting a framework. If the servlets are well written, it should be straightforward in the future to port to a framework if necessary when the app grows in complexity.

Russell Mayor
+1 for "If the servlets are well written ..."
Chris
+37  A: 

I've used Tapestry 3, Wicket, Echo, and JSF fairly extensively. I'd really recommend you look those over and pick the one that appears the easiest for you, and to most closely fit the way you prefer to work. Of them, the most comfortable for me to work with was Wicket, due to the lightweight nature of component building and simplicity of page templating. That goes doubly so if you are using your own db code instead of Hibernate or some other framework (I was never completely happy with Wicket Hibernate or Spring Integration).

Echo is great if you don't mind writing all of your layout in Java. I know that is different now, but I still think that product serves a fairly narrow niche. They change the development model with every major release as well it seems.

Tapestry is a great product, but it is obviously very different from the others in terms of development model as it is led mainly by one dude. Howard Lewis Ship is no doubt quite smart, but I am disappointed with their decision to basically forget backwards compatibility with each release. Again, though, for your needs this may not matter, and I've always found the Tapestry products pleasurable to work against.

JSF has been out for years, and still feels like something that a Struts guy built to fix all of the problems of Struts. Without really understanding all of the problems with Struts. It still has an unfinished feel to it, although the product is obviously very flexible. I use it and have some fondness for it, with great hopes for its future. I think the next release (2.0) to be delivered in JEE6 will really bring it into its own, with a new template syntax (similar to Facelets) and a simplified component model (custom components in only 1 file... finally).

And, of course, there are a million smaller frameworks and tools that get their own following (Velocity for basic needs, raw JSPs, Struts, etc). I generally prefer component oriented frameworks myself, though.

In the end, I'd recommend just taking a look at Tapestry, Wicket, and JSF and just picking the one that feels the best to you. You'll probably find one that just fits the way you like to work very quickly.

jsight
If your Web App is content Based like a forum system, I'll suggest you use GWT and Ext-js. If your Web App is more like a desk app like ERP terminal, I'll suggest you use ZK, Echo3, Vaddin and GWT. I wont suggest any JSF solution because without the fact "It's JEE Standard" I found no benefit to use them.
Zanyking
@Zanyking - If your forum needs SEO, you'll find GWT difficult, imo.
jsight
JSF is probably overkill for a website, instead I would go for more productive frameworks,... developing should stay fun, and JSF has not been build with 'Fun' in mind :)
HeDinges
+14  A: 

I've recently started using the Stripes Framework. If you're looking for a request based framework that's really easy to use, but doesn't impose any limits on what you are doing I'd highly recommend it.

It's similar to struts, but it goes way beyond it. There are even some plugin projects that enable you to do use hibernate or jpa with very little configuration.

There are a lot of good frameworks out there though I've heard wicket is a good one as well, but I haven't used it.

ScArcher2
+20  A: 

I recommend the component oriented Wicket framework. It allows you to write your web application in plain old Java code, you can use POJOs as the model for all components and don't need to mess around with huge XML configuration files.

I had successfully developed an online banking application with Struts when I discovered Wicket and saw how easy web application development can be!

jkl
+9  A: 

UPDATE: Tapestry 5.2 is out, so it's not abandoned, as it previously appeared to be. My experience is with Tapestry 4, not 5, so your mileage may vary. My opinion of Tapestry has changed over the years; I have modified this post to reflect it.

I can no longer recommend Tapestry as I did previously. Tapestry 5 appears to be a significant improvement, but my main issue with Tapestry is not with platform itself; it's with the people behind it.

Historically, every major version update of Tapestry has broken backwards compatibility with extreme prejudice, far more than one might expect. This seems to be due to the incorporation of new coding techniques or technologies that require significant rewrites.

Howard Lewis Ship (the principal author of Tapestry) is certainly a brilliant developer, but I can't say I care for his management of the Tapestry project. Development of Tapestry 5 began almost immediately after Tapestry 4 shipped. From what I can tell, Ship pretty much devoted himself to that, leaving Tapestry 4 in the hands of other contributors, who I feel are not nearly as capable as Ship. After having made the painful switch from Tapestry 3 to Tapestry 4, I felt that I had been abandoned almost immediately.

Of course, with the release of Tapestry 5, Tapestry 4 became a legacy product. I wouldn't have a problem with this if the upgrade path wasn't so brutal again. So now our development team is in the rather unenviable position: We could continue to use an essentially abandoned web platform (Tapestry 4), make the heinous upgrade to Tapestry 5, or give up on Tapestry entirely and rewrite our application using another platform. None of these options is very attractive.

Tapestry 5 is supposedly written so as to reduce the likelihood of update breakage from this point forward. A good example is in the page classes: in previous incarnations, page classes descended from a base class provided by Tapestry; incompatible API changes in this class were the cause of a large number of backward compatibility problems. In Tapestry 5, pages are POJOs which are enhanced at runtime with the "magic Tapestry fairy dust" via annotations. So as long as the contract for the annotations is maintained, changes to Tapestry won't affect your page classes.

If this is right, then writing a new application using Tapestry 5 could turn out well. But personally, I don't feel like putting my hand on the burner again.

Robert J. Walker
Update: As time has gone on, the Tapestry project appears to have been abandoned. There have been no Tapestry 5 releases since April '09, and Tapestry 4, still with a bunch of outstanding bugs in their JIRA, has not had an update since '08. Because of this, I can no longer recommend Tapestry as a viable choice for a web application framework.
Robert J. Walker
Tapestry has not been abandoned. The Tapestry 5 branch is fairly active with 5.1 as the stable option and 5.2 coming soon.
Timo Westkämper
You are right. In fact, Tapestry 5.2 has since been released. I've updated the post to reflect my updated opinion of Tapestry.
Robert J. Walker
+1  A: 

Can't believe no one has mentioned GWT

Kevin Wong
I wouldn't really consider GWT a web application framework really (it's more like a web toolkit, hence the name). GWT is great however, and goes well along with Spring for example.
stian
framework or toolkit, what's the concrete difference really? Coding with GWT feels just as much working with a framework as the other options.
Eelco
A: 

My favorite way to go for really simple apps is Apache VelocityTools (VelocityLayoutServlet) with Velosurf (http://velosurf.sourceforge.net).

For more complex apps, Spring MVC or Struts 2.

Nathan Bubna
+5  A: 

All of them - that's the problem ;-)

+5  A: 

My pick is Wicket!!

Franklin
+3  A: 

Saying "use JSF" is a little to simple. When you decide to use JSF, you have to choose a component library on top of it. Will you use MyFaces Tomahawk, Trinidad, Tobago (http://myfaces.apache.org/)? Or maybe ICEfaces (http://www.icefaces.org/)? Oh, and if you use ICEfaces, will you use JSPs or Facelets for your views?

In my opinion it is to hard to tell. Nobody has the time to evaluate all the promising alternatives, at least in the projects I work on, because they are not big enough to do three month evaluation phases. However, you should look around for some that has a big and active community and isn't gone in a year. JSF is around for some time, and since it gets pushed by sun, it will be around for some more. I can't say if it's the best choice, but it will be a good one.

Tim Büthe
Jsp was a pain for me when doing a Web app we sell. An Update Will consider facelets instead.
Thorbjørn Ravn Andersen
Ya, by this time I'am pretty sure: use facelets instead of JSP. It is much better and I don't see any (big) disadvantages.
Tim Büthe
+1  A: 

Oracle's ADF 11g.

Dave Jarvis
+4  A: 

http://zkoss.org - the good one

ziftech
+7  A: 

Haven't tried it myself, but I think

http://www.playframework.org/

has a lot of potential...

coming from php and classic asp, it's the first java web framework that sound promising to me....

opensas
+10  A: 

Another one to consider would be Grails.

Although it isn't strictly a Java framework, it depends on Groovy (if you haven't seen this before, this is a dynamic language that runs on the JVM). Most valid Java is also valid Groovy, so it is pretty easy to learn.

My last project used Grails, and whilst I'd never used Groovy before, I discovered:

  • Groovy is a joy to use, so much more fun than Java
  • There is very little configuration to do, no XML and you're up and running with a full database application in less than an hour

There is a downside: it is a very "clever" framework that hides a lot from you, so when things go wrong it can be very time consuming to find the problem.

The project I mentioned would simply not have shipped on time or on budget if we'd gone for a more traditional framework (even one that we're familar and skilled with such as SpringMVC), so Grails is definitely one that we'll continue to pick in the future.

(but +1 for Wicket and Stripes, two excellent frameworks).

Dick Chesterwood
+1 for Grails, very productive and we never stress enough the advantage of having a plentytude of plugins to get things done in no time! The plugin architecture makes the difference to all other frameworks mentioned here.
HeDinges
+3  A: 

For high traffic sites I'd use a framework that doesn't manage client state on the server - Wicket, JSF and Tapestry are managing client state on the server. I'd only use those frameworks (Wicket is my favourite) if the application should be more like a desktop application. But I'd try to use a more scalable and simple REST+AJAX approach though.

Spring MVC would be a candidate, but since Spring MVC 3 it has a strange annotation overloaded programming model which doesn't use the benefits of static typing. There ore other ugly things like output parameters in methods combined with a usual return, so there are two output channels of one method. Spring MVC also tends to reeinvent the wheel and you'll have more to configure compared to other frameworks. I cannot really recommend Spring MVC though it has some nice ideas.

Grails is a convenient way to use Spring MVC and other established frameworks like Hibernate. Coding is fun and you'll quickly see results.

And don't forget that the Servlet API with a few little helpers like FreeMarker for templating is very powerful.

deamon
@deamon Nice one. (+1)
Arthur Ronald F D Garcia
+2  A: 

My pick would be Wicket (for large projects and a predictable user base), GWT (for large projects that are mostly public facing) or just a service framework (like Jersey/ JAXRS) together with a JavaScript toolkit (for small to medium projects).

Eelco
+2  A: 

I recommend Seam, especially if you need persistence.

Navi
+3  A: 

I have evaluated quite a few frameworks and Vaadin (http://vaadin.com/home) has percolated all the way to the top.

You should at least give it a short evaluation.

Cheers!

Gilles
+1  A: 

Try HybridJava - that is much simpler than anything else.

Alex
Why? Also, link?
Ed Brannin
http://www.hybridserverpages.com/
opensas
+1  A: 

See a few comments on some Java application Frameworks (second paragraph):

http://swiss-knife.blogspot.com/2009/11/some-java-application-servers.html

Bob Yoplait
+4  A: 

After a long while of testing various solutions, for me it turned out to be:

  • Spring MVC for the presentation and controller layer (NO Spring Webflow though, because my flows are based on ajax)

  • jQuery for all the client side stuff

  • Spring Security for the, well, security aspect

  • Hibernate / JPA2

  • Jetty for the sake of continuations (comet)

One month of an extraordinarily steep learning curve, but now I am happy.

I would also like to mention that I was just a little step away from skipping all that Java stuff and learing Scala/LIFT instead. As far as I am concerned, everything in Java that is related with cutting edge web development (comet, async communication, security (yes, even with Spring Security!)) still is a bit of a hack (proove me wrong by evidence, pleeease!). To me, Scala/LIFT seems to be a more out-of-the-box and all-in-one solution.

The reason why I finally decided not to go with Scala is

  • as a project leader I must consider human resources and Java developers are much easier to find than Scala developers

  • for most developers in my team, Scala's funcional concept, as excellent as it is, is hard to understand

Cheers Er