Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Comparing the Big 5 Web Frameworks

My session at ApacheCon is titled Comparing Web Frameworks: Struts, Spring MVC, WebWork, Tapestry & JSF. I have to turn in my presentation by Friday. The purpose of this post is to get your feedback and see what you'd like to see in such a talk. Here's the abstract:

This session is designed to explore the popular Java web frameworks. It will briefly explain how each one works and the strengths and weaknesses of each. Tips, tricks and gotcha's will be plentiful. A simple web application will be dissected and the different options will be compared. Lastly, it will provide attendees with a sample app they can download that has options to use any of the frameworks described.

The simple webapp is MyUsers from Spring Live. As part of my gig with Open Logic this summer, I wrote a number of sample apps using Equinox. Among these where 1) a Mavenized version, 2) a Tapestry version, 3) a JSF version, and 4) WebWork version. The Struts and Spring MVC versions were already done as part of the book. They agreed to let me use the code and knowledge from that experience. This is all to say it shouldn't be too hard to create the sample app for this talk.

The hard part is going to be talking about things that developers care about. In my post on JSF a while back, I noted the things I typically want in my webapps. The following topics might make good points of discussion.

  • A sortable/pageable list of data. It's possible, but you have to add special sorting logic for each class. JSP already has this with the display tag - I'd simply like to be able to use it in JSF.
  • Bookmarkability. Container managed authentication gives us a great way to offer users the ability to bookmark pages. If everything is a POST with JSF, we lose this ability. Sure there's the HTMLOutputLink, but if we can't invoke actions, what good is it?
  • Clean and easy to read validation messages. The validation messages in both MyFaces and Sun's RI are not something you'd deliver to customers. What's wrong with making clean messages out-of-the-box? Tapestry seems to have no problems doing this. All the other MVC frameworks make you specify your own - which is fine with me.
  • Easy cancelling and multi-button form handling. JSF does this well - better than the rest I'd say.
  • Easy testability. Because of the plethora of JavaScript, JSF apps are difficult to test with tools like jWebUnit and Canoo's WebTest. Don't get me wrong, I love JavaScript - but an application should be able to be tested w/o it.
  • Success Messages. JSF does success messages OK - it's a pity it's not easier to get a resource bundle and it's a shame that you can't escape HTML in the <h:messages> tag. This seems like an oversight to me.

I could do a number of slides and show how each framework handles the above situations. Other topics that would be worthwhile would be:

  • Model in View - can you use your model objects to back forms or do you have to use something like ActionForms?
  • Spring Integration - all of them have this. This would merely be a discussion on how its handled.
  • Validation - how robust and/or extensible is it? How hard is it to do chained validation? What about client-side validation? Is the client-side stuff immature like WebWork's?
  • Internationalization - how is it done and how hard is it to get messages in your classes? JSF sucks at this.
  • The Duplicate Post Problem - how does it handle duplicate posts. Not the "push the submit button twice" but the "hit refresh after saving" kind. Tapestry fails this test.
  • Page Decoration - SiteMesh can be used for all frameworks, Tiles for some. Discuss how much easier it is to use SiteMesh.
  • Tools - since some frameworks have tools to help ease there development and others don't.
  • Business/Marketing - how well known is the framework and will your skills be marketable if you learn it? JSF and Struts are in high demand. Tapestry is virtually unheard of. WebWork is for the evil few (heh!) and Spring MVC is the new kid on the block.

Whaddya think - what is so special about your framework that'll make it look better in my talk? What are the things that suck that I can bash on? If you're a committer on one of these frameworks - are you going to be at ApacheCon? I'd love to have some folks defend their projects after I'm done ripping on them. ;-) If I don't rip on yours, then you can bask in all its glory.

If you live in Denver, I'll be delivering this presentation at DJUG's Architecture SIG on November 3rd.

Posted in Java at Oct 12 2004, 11:59:16 PM MDT 28 Comments

what exactly is the "Easy cancelling" in "Easy cancelling and multi-button form handling."? if I need to cancel a form, I just hit some link that takes me elsewhere.. am I missing something here?

Posted by Francisco Hernandez on October 13, 2004 at 12:44 AM MDT #

Cancelling actions are usually in the form of buttons rather than links. The easy way to code these is to put an "onclick" handler that goes to the page where you want to cancel to. However, that doesn't take into account JavaScript being turned off. With most frameworks, you can somehow map that button to a method, or in the case of JSF - you simply specify an "action" attribute and map that "action" to a page in your faces-config.xml. "Cancelling" an action is basic user interface stuff that a lot of webapps don't take into account (at least in my experience).

If this is a topic you feel is mundane or boring, let me know and I'll zap it.

Posted by Matt Raible on October 13, 2004 at 12:51 AM MDT #

I forgot to answer about multi-form buttons. This is just meant to explore how the different frameworks allow you to map buttons to methods. Some frameworks have mechanisms for doing this and others require you to look at the request parameters and handle it yourself.

Posted by Matt Raible on October 13, 2004 at 12:52 AM MDT #

the form cancel button issue is pretty boring and mundane so yeah, get rid of it, I've been implementing it as just a simple link to some other page, doesnt even have to be part of a form another thing is persistent messages/errors across redirects, this is something I know webwork doesnt have, I almost always use redirects after creating/deleting/updating objects and would be nice if this were built-in another is ability to put i18n messages in just one or multiple files, not one-per-class like some other frameworks enforce one thing I liked about tapestry in my brief foray into it is how the label component was aware of validations or at least some validations, it was a bit inconsistent though, like forexample, if I apply the required validator on a field it should automatically put the little * or whatever besides that field (instead of having to use required=true), the tag in ww should be aware of the validation thats being applied to that field and vice versa

Posted by Francisco Hernandez on October 13, 2004 at 01:32 AM MDT #

Will the presentation be available for those of us not going to ApacheCon and living a bit far away from Denver?

Posted by Carlos Sanchez on October 13, 2004 at 03:24 AM MDT #

<p align="justify">Hey Matt, nice work on the comparison. I think it's gonna be really great. My experience with Web frameworks is very brief: I started using Struts some months ago because it was the only one I've heard at the time. Pretty soon I got bored with the horrible XML syntax and didn't like the API. I even started my own MVC framework, when I heard of WebWork and started using it. Liked it a lot and have been using it ever since.

<p align="justify">I'm very interested on this comparison material. If it's your intention to disseminate it as much as possible, send it to me and I'll translate it to Brazilian Portuguese and post it on my blog. Cheers!

Posted by Vítor Souza on October 13, 2004 at 06:38 AM MDT #

For POST actions, I allways redirect to a GET url after the action, to allow the user to reload the resulting page as necessary. It makes for a bit more unclean Struts action code though.

Posted by Torgeir on October 13, 2004 at 06:43 AM MDT #

I vote to keep every item on the list! Unfortunately, I won't be there for the presentation.

Posted by Gary Blomquist on October 13, 2004 at 07:08 AM MDT #

I'm re-asking Carlos' question cause I didn't see a reply from you. Are you gonna post the presentation on-line? Would you like someone to proof your slides before you give the presentation? I'll be glad to. Erik

Posted by Erik Weibust on October 13, 2004 at 10:22 AM MDT #

Carlos and Erik - I don't believe there's any restrictions on publishing my presentation before the conference. I'll double check with the organizers. In reality, I'd love to publish it here and get feedback from the various framework users and developers. This would likely make the presentation a lot better - which is obviously a Good Thing.

Torgeir - redirecting after POST is my preferred solution as well. This doesn't work so well in some frameworks. For example, with Tapestry you have to throw an Exception and from my experience, that still doesn't perform a redirect/GET request. A fair amount of the frameworks have support for saving success messages, but only Struts has built-in support for allowing these messages to survive past a redirect.

I'll try to post an outline and feature list for the sample app tomorrow.

Posted by Matt Raible on October 13, 2004 at 10:39 AM MDT #

I guess this is kind of related to tools, but something about how well each framework is suited to different styles of development. For example: - the one person do independent consultant - the extreme programming team - the "completely separate HTML/CSS guys" crowd - the "we are all VB'ers who now have to do Java" crowd You could also touch on learning curve, etc ...

Posted by Bill Siggelkow on October 13, 2004 at 10:44 AM MDT #

I like your comparison items. The one thing I always like from someone providing comparative information is their opinion. Almost anyone can compile technical details, but you're talking because they want your opinion. Your opinion on what technical details are important but also your opinion on which of these frameworks are good and which ones stink. Stick your neck out, go out on a limb and complete the sentence "If i had to standardize on one of these frameworks today I would use ..." Explain your decision in light of the details you've just presented. Obviously no one's going to hold you to it and once you've completed the technical comparison it's a surefire way to get some conversation going.

Posted by Mike Foody on October 13, 2004 at 11:10 AM MDT #

This is probably beyond the scope of your presentation, but in general it would be good to measure the frameworks ability to handle complex forms, such as a grid of data with N rows, or a dynamic form where the number of elements and types of elements were data driven. I have to make grids all the time, and data driven forms a fair amount. Doable in struts, but it's a pain.

Posted by Ted on October 13, 2004 at 01:43 PM MDT #

Also if it's a general frame work, how extendable is it to service SoA requests that come in, and can it be extended to output RiA.

Posted by Vic on October 13, 2004 at 02:05 PM MDT #

Container managed authentication gives us a great way to offer users the ability to bookmark pages.

I thought the "Invalid direct reference" problem in CMA hindered the ability of users to bookmark login pages. I've been using security filter instead. Can you explain what you mean by this comment?

Posted by Brian on October 13, 2004 at 02:39 PM MDT #

To go along with Mike's comment, not only would I want you to pick the one framework you'd currently use, I'd also want to know under what circumstances you'd choose to use a different framework.

Posted by Winston Rast on October 13, 2004 at 03:43 PM MDT #

A 2nd vote for the input grid of N rows of data input and complex forms.

Possibly related to the bookmarkable and duplicate-post criteria: does the framework break the browser's back button? If the user is entering multiple similar records, can they use the back button, change a few items and submit without errors? Or same story with a meaningful error message?

How much control over the design of the URL does each framework offer? I know that all URL design problems can be solved by mod_rewrite, but suppose mod_rewrite isn't available for some installation. What does the framework let me do?

To what degree do the frameworks separate these concerns: Workflow, Action, Representation, Storage?
see also:

Posted by Eric Dobbs on October 13, 2004 at 04:59 PM MDT #

To answer some questions on WebWork's behalf: For redirects, WebWork provides a "redirect" result which will redirect to a configured URL. Right now WebWork doesn't have a facility to save messages across a redirect, but we could whip one out in probably 30 mins to an hour. Maybe 1 1/2 hours with good tests :-)
Also if it's a general frame work, how extendable is it to service SoA requests that come in, and can it be extended to output RiA.
Xwork, the core generic framework underneath WebWork, can be used in many environments. We already have an XML-RPC dispatcher, and I've written a JMS dispatcher framework on it (called MessageWork and in the xwork-optional CVS on It would be pretty easy to make one to take SOAP requests, etc.
A 2nd vote for the input grid of N rows of data input and complex forms.
OGNL, the expression language used in WebWork 2.0+, makes handling N rows of data pretty easy. You can easily index into Arrays, Collections, or even Maps using this notation: property[index] Also, WebWork can create and populate Collections for you using our XworkList. If the collection comes back null when trying to index into a Collection, and you've specified the type that's supposed to go into it (using a .properties file that's used for type-conversion config) then it will create empty objects of that type to fill out the collection to the one you're trying to get. Pretty cool.

Posted by Jason Carreira on October 13, 2004 at 06:36 PM MDT #

What about Oracle Application Development Framework? Is it good enought to be compared to these famous frameworks? I find adf very flexible and it really makes the whole application development process very easy - from very begining till the end. Some features: - Like any other frameworks, it is also based on mvc architecture. The Apache Jakarta Struts controller, an open source framework controller, is the de facto standard controller for Java-based Web systems. Oracle ADF uses the Struts controller to manage the flow of Web applications. Oracle ADF Faces is a rich set of user interface components based on the new JavaServer Faces JSR (JSR-127). ADF Faces also includes many of the framework features most needed by JSF developers today. Oracle ADF Faces Components can be used in any IDE that support JSF, including Oracle JDeveloper 10g. The intention with early access release of ADF Faces is to give developers/architects an opportunity to evaluate JSF and Oracle's JSF component offering.

Posted by SUJAN SHRESTHA on October 13, 2004 at 07:13 PM MDT #

Just to clarify Brians comment. CMA allows you to bookmark any page, except the login page. If a user browses to a bookmarked page for which he is unauthorized, he will be prompted to login and, once authenticated, be redirected back to the originally requested page. The "Invalid direct reference" page can be mitigated somewhat through some hacks with JSP and redirects.

Posted by Bill Siggelkow on October 13, 2004 at 08:17 PM MDT #

Wow. I think that you have too much to cover. You'll most likely want to shrink this down than grow it. Couple things that I learned for the NFJS that you might want to consider. It hard to remember everything from these type sessions, so make sure that notes or hand-outs have a lot of support information. Try involve the group with code or Q&A. I noticed that I enjoyed and remember things more from Dave Taylor, Mike Clark, Ben Galbraith Sturat Halloway. All of these had code example or demos you go back. The more the better. You have myusers and etc, so showing this might help. Whereas the high-level talks with Bruce Tate just didn't stick for me. I also think you might want to talk with the NFJS folks. It looks like you have at least one, if not a couple talks based on this. You might also want to spend some time talkin' about why Spring or lightweight containers make sense. Best of luck, Jeff

Posted by Jeff Duska on October 15, 2004 at 09:01 AM MDT #

Brian and Bill - the CMA "bookmarking the login page" problem has went away in most modern containers. Both Tomcat 4.x and Resin 3.x now "forward" to the login.jsp rather than "redirect" - so the user is never aware of the login.jsp's URL. Rather, they only see the protected resource's URL that they are trying to access.

Posted by Matt Raible on October 15, 2004 at 11:48 PM MDT #

Doh - I meant Tomcat 5.x. ;-)

Posted by Matt Raible on October 15, 2004 at 11:49 PM MDT #

The time you've spend writing this post is already worth the time to get you on Rails. :)

No fancy whitepapers or enterprise patterns pissing contest here. Just a compact (about 1kloc), intelligible and highly introspective piece of code. No need for redundant declarations (struts-config.xml, anyone?), it's all in the code. At last, here's a framework which do not try to reinvent the wheel by creating some sort of web abstraction layer and which will help you build stuff according to the standards of the web platform as defined by the W3C; and those are not going to dramatically change anytime soon...

Programming language apart (I presonally would have prefered Python over Ruby), Rails is the only web framework I've seen so far which has been designed by people doing actual web development and not some wimpy bowtie-wearing COBOL programmer who had to switch to Java web programming after a two week bootcamp at Sun Training Center.

I urge everyone interested in web frameworks to have a look at Rails. You'll just get desperate to see how clumsy the Java world has become while others are getting to job done with their "toy languages".

<cite>?There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult."</cite> (Tony Hoare)


P.S. : Stop complaining about Ruby' (supposed lack of) "scalability" already, please. I'm talking about framework architecture, here. We are in 2004, scalability is more of a system issue now, otherwise you guys wouldn't be using Java, would you? I do also know that your boss just like mine will never bet his seat on something like Rails eventhough it could spare the company hundreds of hours of development and maintainance time.

Posted by Xavier on October 17, 2004 at 04:25 AM MDT #

Hi Matt, I am interested in your work "Comparing Web Frameworks: Struts, Spring MVC, WebWork, Tapestry & JSF". Would you mind to letting me know how would I be able to get a copy of it? Thanks.

Posted by Lian Guan on May 25, 2005 at 11:42 AM MDT #

Hello Matt, I read about your comparison of current web frameworks like Struts, WebWork and so on. I'm mainly interested in the aspect of controlling the page flow (for example wizards) and would like to know what kind of support if offered by the different frameworks´, especially Webwork and Spring Web Flow (SWF). Is it possible to send me a copy of your comparison material? Thanks in advance Henning

Posted by Henning Meinhardt on June 02, 2005 at 08:24 AM MDT #

Hello Matt, I read about your comparison of current web frameworks like Struts, WebWork and so on. I'm mainly interested in the aspect of controlling the page flow (for example wizards) and would like to know what kind of support if offered by the different frameworks´, especially Webwork and Spring Web Flow (SWF). Is it possible to send me a copy of your comparison material? Thanks in advance Henning

Posted by Henning Meinhardt on June 02, 2005 at 08:25 AM MDT #


Posted by on January 18, 2007 at 10:27 AM MST #

Post a Comment:
  • HTML Syntax: Allowed