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.

10+ YEARS


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 Web Frameworks: Presentation Outline

My Comparing Web Frameworks outline is due to the ApacheCon Planners today. I spent a couple of hours putting it together this morning and I'm mostly done. In reality, I know that I won't cover the things that everyone wants to know. In an ideal world, I could simply target the presentation towards people like me: they know Struts but want to learn more about the other frameworks. Before diving in, they want to know some things to watch out for.

The problem with doing that is writing for people like me sometimes backfires. I'd like to make it an advanced presentation, but I'm not an authority on all 5 frameworks - so that seems a bit far fetched. However, if I could add Tapestry and JSF support to AppFuse in the next two weeks - I'd have a lot more experience to refer to. But that ain't gonna happen - the first update chapter for Spring Live is due next week. OK, enough rambling - here's the slide titles I've come up with. So far, it's 22 slides and shouldn't grow any since it's supposed to be finalized when I submit it.

  • Who is Matt Raible? My background, open source involvement, etc. Trying to give myself some credibility. ;-)
  • Framework Experience: Long time Struts user, used Spring since end of last year, developed apps with other three this summer. AppFuse supports Struts, Spring MVC and WebWork; Tapestry and JSF coming before end of year.
  • Meet the Candidates
    • Struts: Pros and Cons. Pretty much a standard, lots of examples, HTML tag library kicks ass. ActionForms kinda suck, can't unit test (only StrutsTestCase integration tests), Mailing list is swamped.
    • Spring MVC: Nice lifecyle (for overriding binding, validation, etc.) integrates with many view options seamlessly, IoC for easy testability. Not widely used, requires lots of code in JSPs, almost too flexible (no parent controller for SimpleFormController and Controller).
    • WebWork: Simple architecture, tag library easy to customize, interceptors are pretty slick. Documentation only recently written, few examples, client-side validation needs work.
    • Tapestry: Very productive once you learn it, templates are HTML (great for designers), healthy project. Documentation very conceptual, rather than pragmatic (lots of "read the book"). Steep learning curve, few examples. Impossible to test - page classes are abstract.
    • JSF: J2EE standard (lots of demand and jobs), fast and easy to develop with, rich navigation framework. Tag soup for JSPs, a bit immature (doesn't come with everything), no single source for implementation.
  • Controllers and Views: Show controllers for all 5 frameworks and template page (JSP/HTML) for forms. Give URL to download sample apps.
  • List Screens: How easy is it to integrate a sortable/pageable list of data? Struts, Spring and WebWork can use tag libraries like the display tag, value list or data grid. Tapesty has contrib:Table. JSF has dataTable component that requires custom logic for sorting (let me know if this has changed).
  • Bookmarking and URLs: Struts, Spring and WebWork give you full URL control. Tapestry has ugly URLs. JSF does a POST for everything. Conclusion: first 3 play nicely with container-managed authentication. Tapestry doesn't (although there's a patch for pretty URLs). JSF is not friendly to bookmarking.
  • Validation: Struts and Spring MVC can use Commons Validation - a mature solution. I've heard it's architecture is ugly, but who cares - it works! WebWork uses OGNL which allows powerful expressions. Client-side support is new and maturing. Tapestry has robust validation w/ good messages out-of-the-box. JSF has ugly default error messages, but is the easiest to configure.
  • Testability: Struts you can use StrutsTestCase, which requires web.xml and struts-config.xml. WebWork and Spring allow easy testing with Mocks. Spring has a spring-mock.jar that can be used for mocking the Servlet API with any framework (it's not Spring-specific). Tapestry is impossible to test because page classes are abstract. The argument I've hard is "you don't need to test them b/c they're so simple." JSF page classes can be easily tested and actually look a lot like WebWork Actions (except they don't extend anything).
  • Success Messages: The easiest way to solve the duplicate-post problem is to redirect after doing a POST. Struts is the only framework that allows for success messages to live through a redirect. It's fairly easy to get i18n messages in a Struts Action. Spring has nothing "built-in" for success messages. Long classnames / method arguments make it kinda clunky to get messages. WebWork has the cleanest way to get messages using a simple "getText()" method. Both require a custom solution to make your messages live through a redirect. Tapestry requires you to throw an exception to redirect and it still doesn't redirect (I haven't solved the duplicate post problem with Tapestry). JSF requires lots of code to get a ResourceBundle, but you could use Spring's IoC to inject a "messageSource" bean, making it a lot easier. JSF requires a custom solution for messages to live past a redirect.
  • Spring Integration: Supported by all, sample apps have examples (quick slide).
  • Internationalization: JSTL's <fmt:message> tag makes it easy in all JSP-supporting frameworks. Too bad there's not a standard for getting bundles in controllers and setting messages. Struts, Spring and JSF encourage you to use one ResourceBundle for all messages while WebWork and Tapestry encourage separate files for each page/action. This strategy is probably better for large teams.
  • Page Decoration: I used to be a huge advocate of Tiles (using it since August 2001). SiteMesh is much easier to setup and use. Tiles can be used in Struts, Spring MVC and JSF. SiteMesh can be used with all 5 frameworks. In fact, the sample app uses the same SiteMesh setup for all w/o changing a thing. SiteMesh requires no maintenance, Tiles requires you add entries to tiles-config.xml whenever you add a new page.
  • Tools: Struts has lots of tools available for it and even frameworks built on top of it (i.e. Beehive's NetUI/PageFlow). Spring has Spring IDE which is really just an XML tool for validating your bean and their relationships. WebWork has none (that've been released), but it is on the roadmap. Tapestry has Spindle, which is great for code-level programmers. It doesn't do drag-n-drop, but it does validate relationships between files. JSF has lots - but all of them cost money and tend to hook into proprietary app servers.
  • Business/Marketing: Struts has lots of jobs and is well-known in the industry. A lot of enterprise applications are based on it. Spring is getting more press, but mostly because of the framework's other features. Knowing the rest of Spring is more valuable than Spring MVC. WebWork is gaining ground, but it's still virtually unheard of on job boards. If you do get gigs using WebWork, it's likely word-of-mouth and you'll probably be working with some pretty smart people. Often used with Spring and Hibernate. Tapestry needs more marketing - no one has heard of it, hence no jobs exist for it. JSF is quickly becoming the most popular. Want to stay employed? Learn JSF. The best reason: so you can back up your arguments on why you do/don't like it.

    Dice Job Count: Struts (1006), Spring (15 - not a very good name for searching, used "spring framework"), WebWork (14), Tapestry (9), JSF (147).

  • My Opinion: You have to come to the conference for that ;-). Slides should be posted following my presentation.
  • Resources: Link and such for downloads, frameworks and tools mentioned.

Comments, suggestions, like it/hate it? Let me know. I expect to send this in in a few hours - so you'd better be quick!

Posted in Java at Oct 15 2004, 12:02:03 PM MDT 22 Comments
Comments:

Matt, I would also like you to touch upon the list IDEs that have "some" support for these frameworks.

Posted by Sekar on October 15, 2004 at 06:16 PM MDT #

Hey Matt. For those of us that can"t make it to the conference, would you consider posting your Opinion(s) here? I think that it would be well received :) Thanks.

Posted by angelo on October 15, 2004 at 06:18 PM MDT #

Sekar - I'd be happy to add a list of IDEs and what frameworks they support. However, since I tend to use my IDE for nothing more than a fancy text editor - I'm not an expert on which ones support what. I know that MyEclipse supports Struts and JSF and pretty much everyone supports Struts, but that's about it.

Angelo - I'll post my slides after the talk with my opinions. In reality, I need to integrate Tapestry and JSF into AppFuse before I can judge them all equally - so it might be awhile until I arrive at a "justified" opinion. ;-)

Posted by Matt Raible on October 15, 2004 at 07:12 PM MDT #

Matt, outstanding IMO. I hope to catch your presentation at the DJUG Arch SIG mtg Nov 3. The only addition I can think of is to discuss issues related to deployment on various servers, if any.

Posted by Winston Rast on October 15, 2004 at 07:52 PM MDT #

Re: ActionForms.
Some people, like me, have been using Colections in place of ActionForms, becuase Struts supports it. .V

Posted by Vic on October 15, 2004 at 08:41 PM MDT #

Struts and JSF You might want to keep the Struts + JSF perspective in mind.

Posted by Ted on October 15, 2004 at 09:23 PM MDT #

Some time ago Howard addressed the issue of being able to test Tapestry abstract classes (Note it is optional to make them abstract - less work if you do though). See http://howardlewisship.com/blog/2004_05_01_archive.html and http://howardlewisship.com/downloads/TapestryTestAssist.zip

Posted by David Channon on October 15, 2004 at 10:18 PM MDT #

What is the double post problem on success messages? Looking forward to your conclusion after you integrate Tapestry into AppFuse. I think it's the most interesting framework, but to stay gainfully employed as a consultant, we'll have to break down and use what companies want (Struts/JSF)-:

Posted by Ken Yee on October 15, 2004 at 10:50 PM MDT #

never mind on the double post question. It was in your other blog entry: "hit refresh after saving"...

Posted by Ken Yee on October 15, 2004 at 10:53 PM MDT #

W/regards to validation, don't forget to mention Spring's very powerful pluggable (programmatic) server side validation stuff, which lets you use validation objects both at the view and business layer, since they are not tied to the view. W/regards to testing Tapestry pages. One mechanism which works is to just for the testcase, subclass your abstact page class with a non-abstract version for the test, which stubs in real methods for the abstract ones. The abstract ones are typically just for returning properties anyways, so it's entirely appropriate to have them return test-specific data for the test. Where it gets more complicated is if the page depends on a lot of other tapestry intefaces, but if you split up your methods properly it's reasonably easy to test the actual business logic.

Posted by Colin Sampaleanu on October 16, 2004 at 07:06 PM MDT #

About "JSF requires a custom solution for messages to live past a redirect." I may be wrong but I believe this might be false. I'm pretty sure that you can develop entire site using the redirect on post pattern simply by using JSF Navigation's <redirect/> tag. In a navigation-case. I have most all of my forms using <redirect/> and I believe all my messages make it to the destination. If I'm right then this solution would be even simpler than Struts where you need to make sure an save your messages using your session instead of request. If I'm wrong then I'll be sure and do a test case before I post claiming you're wrong about something next time. :) Mike

Posted by Mike Youngstrom on October 17, 2004 at 12:08 AM MDT #

One other note the comment "SiteMesh can be used with all 5 frameworks." You might want to add the caveat that if Sitemesh is used with JSF then you can't us JSF anything in you're decorators. Decorators for JSF can only be simple plain JSPs. Mike

Posted by Mike Youngstrom on October 17, 2004 at 12:12 AM MDT #

With regards to the "JSF requires a custom solution for messages to live past a redirect." I had some spare time and tested it myself. Any you were correct. Sorry about that. :) Mike

Posted by Mike Youngstrom on October 17, 2004 at 12:55 AM MDT #

Have you looked up http://webonswing.sourceforge.net/xoops/? It seems really cool, wraps swing components, you can use the whole swing incl. VisualDesigners, you have templates a la tapestry, and a lot of other things, like they are going to wrap other server side hirarchies (SWT, JSF, tapestry etc) /peter

Posted by Peter Neubauer on October 18, 2004 at 06:54 PM MDT #

Laszlo deserves some attention as well. It is an opensource alternative to Macromedia Flex. It is not as powerful as of now (lacks some of the UI components that Flex offers and visual designer tools). Hopefully if it could attract more developer to contribute, it certainly have potential

Posted by Jack Hung on October 19, 2004 at 03:15 PM MDT #

You Dice stats for JSF seem a bit off. Are you sure you didn't count Lockheed jobs for the Joint Strike Fighter (JSF)? When I removed those I got less than 20.

Posted by Howard on October 20, 2004 at 01:27 AM MDT #

You should tell your opinion now. :) I want to develop my first web app and i feel like i'm in hell surrounded with frameworks.

Posted by Necrodome on October 20, 2004 at 01:46 PM MDT #

That's a good point Howard. How did you exclude Lockheed in your search? Did you just exclude the company, or did you figure out a way to exclude the Joint Strike Fighter?

Necrodome - if you have the time, I'd learn Tapestry. If you don't (and you're not familiar with other frameworks), I'd learn WebWork (it's the easiest to learn). Of course, learning and using Struts will result in the best job. Even if you learn the other two, you'll still need to know Struts b/c there will likely be a lot of porting from Struts to Component Frameworks in the future.

Posted by Matt Raible on October 20, 2004 at 02:02 PM MDT #

Hi,
Been reading your blog for a while. Never got to contribute before. As for nice urls, do you know about the urlrewrite filter by Paul Tuckey (http://tuckey.org/urlrewrite/) ?
Works quite well and plays nice with sitemesh (which you introduced me to).

Posted by Patrick Turcotte on October 21, 2004 at 11:21 AM MDT #

Patrick, I am aware of the Url Rewrite Filter. It's definitely a nice piece of software, and I did add it to AppFuse last week. You might be right about using it with Tapestry, however - I believe the Friendly URLs patch makes it so generated URLs are nice looking too.

Posted by Matt Raible on October 21, 2004 at 01:25 PM MDT #

http://www.waferproject.org/feature-matrix2.html is well worth a visit as an open source java framework evaluation project. How about Cocoon which has the most features both core and integration (but unfortunately not EJB integration yet)? 10 minutes for a modular web site template seems a good result with Apache-Forrest (which might not count for your purposes).

Posted by Jim Stuttard on November 26, 2004 at 03:26 PM MST #

http://www.waferproject.org/feature-matrix2.html is well worth a visit as an open source java framework evaluation project. How about Cocoon which has the most features both core and integration (but unfortunately not EJB integration yet)? 10 minutes for a modular web site template seems a good result with Apache-Forrest (which might not count for your purposes).

Posted by Jim Stuttard on November 26, 2004 at 03:26 PM MST #

Post a Comment:
  • HTML Syntax: Allowed