Boost Your Productivity Using Apache Tapestry

13 09 2008

If you are like me, you really don’t have time to waste with frameworks that suffer from favoring “elegance of design over everything else”.. take the old EJB model as an infamous example.

Personally, all what I care about is finding new ways to improve productivity. Nowadays, I prefer frameworks and APIs that are designed for simplicity of use in the first place. You invest some time and effort, and gain back generous increases in productivity.

If you’re into Java-based web applications, you probably know how challenging it is to develop the UI Layer of the application — while keeping View code clean (readable) and neatly separated from back-end code.

That’s why a number of months ago I decided to go on the hunt for the ultimate UI framework — if it ever existed. I pictured a framework where complexity of handling UI events and moving data back-and-forth between Model and View is hidden from the developer, such as with desktop applications.

I enumerated a number of frameworks from I did not consider some excellent technologies such as AdobeFlex and another framework called ZK (watch out for that one) just because you do not write the interface in HTML or any close markup, but rather in completely different proprietary language.

I also ignored frameworks that do not have an online demo. Presence of an online demo is the least thing framework owners should offer to their prospective users… lack of an online demo gives me negative vibes about the health of a UI technology.

I ended-up looking at a couple of JSF implementations, Apache Tapestry, and Apache Wicket based across several dimensions:

  • Learning Curve
  • Maturity (which reflects on other traits such as reliability, security, and performance)
  • Programming Model
  • AJAX Support

The following are the results of my quick research. This is not an extensive research, with anything but concrete results. I was in a rush (as always!). I just brushed over the surface, with high reliance on first impressions and short test drives. Use the results with caution!

I easily ruled out JSF. I got the impression that it was plagued with the same “elegance of design over everything else” virus that used to plague Java specs (the situation is getting better now). As usual, JSF needs tedious XML configuration. Plus, web pages are written in JSF markup which is a turn-off to me. Yes, I don’t care that JSF is a specification.

There was a number of open-source implementations: Apache MyFaces and IceFaces. Only IceFaces seemed to be mature and impressive enough anyway. The documentation of IceFaces was far from complete or accurate, and it seemed to me that in addition to the learning curve of JSF, there will be another trickier learning curve mounted over it… to learn the “secrets” and internals of IceFaces (that was with version 1.5 as I recall, now I’m seeing a version 1.7 so perhaps things have changed).

What really clicked with me were Apache Tapestry and Apache Wicket. There is some similarity between them; they are both “component-based” frameworks that map parts of the UI in the HTML pages 1-to-1 to Classes and Objects on the server. Component-based frameworks are far more easier to deal with than JSPs and other frameworks that expose the cycle of request/response handling (such as the old Struts). Tapestry hides the request/response handling cycle pretty neatly.

So, I gave Tapestry a try. Although the documentation is not the best that they could offer, it is very extensive. The quick-start guides delivered a really quick start. I actually was able to write a simple application in a couple of hours, and boy, I was impressed with Tapestry’s potential. We’re talking super-productivity here once you get over the initial (relatively shallow) learning curve. Add to that the following great advantages:

  • You write your Web Pages in pure HTML (now XHTML with Tapestry 5)… Tapestry’s markup is elegantly hidden within HTML markup.
  • Moving data from your business logic to the web UI and back is as easy as populating and extracting data from POJOs using setters and getters.
  • Built-in AJAX support, DOJO and Scriptaculous are integrated.
  • It is easy to build your own components and extend the framework.
  • Page navigation is easy and intuitive… no need for lengthy XML files as in JSF.
  • Persisting data into a Session is a matter of calling a “set” method on an annotated POJO field.
  • Tapestry adopts the convention-over-configuration philosophy. No piles of XML configuration files, just put the jars in your Lib directory, add a couple of entries in your Web.xml, and everything just works.

After I experienced Tapestry, I was quite impressed and decided to skip Wicket and get started with Tapestry immediately. Tapestry and Wicket are more or less similar, only Tapestry is more mature. However, Tapestry has its flaws as well, ones that I recognized when I got up close and personal with the framework. So, if you decide to use Tapestry, be ready to live with the following issues:

  • First, you have to decide which Tapestry version to use. 4.x and 5.x are completely different and there is no backward compatibility. 5.x has been in “beta” stage for a long time now, but as far as my experience goes, it is stable. 5.x is far more simple than version 4.x due to its streamlined design and the use of Annotations.
  • The documentation on the website is extensive and sufficient… but as soon as you start meeting more complex scenarios, things start to get a little darker… and in some cases, you might need to do the occasional dive into the internals of the framework to understand how things work.
  • Tapestry 4.x is not satisfactory on the performance side due to the design of its request/response handling cycle. 5.x is much better on the performance side.
  • For some reason, the releases of Tapestry are few and far in between. I don’t know why. That framework has lots of potential.
  • The only book on Tapestry covers 5.x and seems to be significantly outdated. Many of the book’s examples are obsolete and do not work with the latest release of 5.x. So that brings us back to rely on online documentation.

Bottom line: Tapestry is a great framework that boosts productivity, a framework that has been elegantly designed and written for the sole purpose of making your life easier. The cons of Tapestry can be lived with, and the framework’s clean design makes it easier to understand its internals. You’ll enjoy working with Tapestry. Kudos to the Tapestry Project team.




14 responses

13 09 2008

You really should have given Wicket a try, really 🙂

14 09 2008
Howard Lewis Ship

Thanks for giving Tapestry a shake-down. My major quibble is using the words “elegance” and “JSF” in the same sentence. Also, I don’t like to miss an opportunity to remind people about Tapestry’s live class reloading, and it’s excellent exception reporting. Finally, T4 is based on Dojo, and T5 is based on Prototype/Scriptaculous, though I’ve seen many sites using additional libraries such as jQuery.

14 09 2008
Gabriel Lee

Ouch, you should have followed through with Wicket before making your choice. The evolution of Wicket is much more community driven than Tapestry. In my humble opinion, I advise you to switch to Wicket before you develop too much in Tapestry (which most likely will not be compatible in the next release of Tapestry anyway 😉

14 09 2008

Gabriel, I already have set my mind on giving Wicket a try. What I did not mention explicitly above is that Wicket seems to be more active than Tapestry — it has more frequent and recent releases, so that sends good signals about the health and evolution of Wicket.. I believe it is a matter of trade-offs, so the best course of action would be to weigh the pros and cons of each.

15 09 2008
Gabriel Lee

Hi manany, great to know you’re giving Wicket a try! You’re right in observing that Wicket has a more active and healthier community. Having an active community has also enabled Wicket to have respect for backward compatibility, which is painfully lacking in Tapestry.

Regarding your observation on the lack of Tapestry books, it is a given that authors wouldn’t risk writing a book on Tapestry knowing well that the next release of Tapestry is most likely to render their books obselete. 😉

Have fun with trying out Wicket! 🙂

15 09 2008
Jose M. Arranz

Have you tried ItsNat?

Following your schema:

* You write your Web Pages in absolute pure HTML,XHTML or SVG (SVG includes AJAX) .
* HTML is not “polluted” with logic, the view is fulled controlled in Java using Java W3C DOM APIs pushing data to the view where and when you want.
* Built-in AJAX support with no external dependencies. Other JavaScript frameworks can be integrated calling the server using the ItsNat feature “user defined DOM events”.
* It is easy to build your own components and extend the framework. In fact, you don’t need components, pure Java W3C DOM APIs may be enough = learning curve near zero.
* Page navigation is easy and intuitive… no XML. ItsNat is focused for AJAX and the single web page approach, but it has some interesting features like “referrers” where markup in DOM form can be transported/reused between pages.
* Sessions? you don’t need web sessions in an AJAX application.
* Again no XML configuration, configuration is programmatic promoting reusing and batch configuration. Just put the jars in your Lib directory, add several .js files.
* … many more things.

15 09 2008
jim weaver

We have had a website in production on tapestry 3 for about three years now, and it has served us well. We built the application so that the presentation layer is isolated from domain logic, workflow code, and service access, so even through tapestry is not backward compatible, replacing 3 with 5 is not going to be a major effort. The basic concepts are all relatively unchanged.

I admit I have not looked at Wicket, but even though Tapestry is more of a one man product that a community process – that is not in and of itself a bad thing. A strong vision holder is good either way. I’d like to see a fair comparison of wicket and tapestry – by someone who has worked with both frameworks.

15 09 2008

Hello Jim,

Concerning backwards compatibility, I was working on a website made using Tapestry 4, and then when we moved on to Tapestry 5.. we assessed the feasibility of modifying the 4.x-based code first as common sense would dictate. In the end, we literally had to rebuild the UI layer all over again.. so, my believe is that from 3.x to 5.x is going to be a major effort indeed.

All in all, I’ve had a great experience with Tapestry (5.x especially, which I highly recommend) despite the setbacks I’ve mentioned. I’m also eager to try Wicket. Meanwhile, could anyone who had experience with Wicket share it with us — pros and cons?

16 09 2008
jim weaver

Hi Moataz,

I expect we would have to rewrite most of the UI layer, but the thing about our app is the UI layer was purposefully kept very thin (aside from the html). Our tapestry 3 page classes generally don’t do anything except delegate to POJO controllers (wired in via Spring) to do work, and then the POJO controllers talk back to the UI layer through an interface to tell the UI to do things like navigate to a page and display a success message, etc. That allowed us to keep the vast majority of our code in POJOs that don’t know anything about Tapestry, and will make a 3 to 5 conversion a lot easier – that whole control layer shouldn’t have to change at all. We won’t take advantage of some of the “RAILS-like” features of tap5 (hibernate wiring etc.) because of the architectural separation of the UI from other concerns in our app – but that doesn’t bother me.

Now, html part of pages/components will change some (ognl is gone, etc.) and we have some components (drop list / text combo boxes etc.) that we will probably have to largely rewrite.

We’ll see – we’ll probably try to convert just a small slice of the application first to get some idea of the labor involved, and I would like to see a wicket comparison before we commit to converting to tap 5. We may do one ourselves in coming months. We’ll certainly wait for tap 5 stable release before we even consider a conversion.


18 09 2008
Florian B

I started with Tapestry 5 last year, being relative green in web development. We developed a few medium-sized websites used in production. Now [after a pause of 3 months] again I am looking forward to use Tapestry 5 again, with all the improvements made.

Can anyone who used BOTH frameworks in production make a comparison between those products?

22 09 2008
Wilson Ikeda

22 09 2008
Wilson Ikeda

Sorry, post link inside the tags but i think missed something:
Link for a “glimpse” between Wicket and Tapestry.

I work for a small company and we are just 4 to do all the job. Our last project was build using struts-spring-ibatis-velocity and was full of duplicated code and was very time-consuming so we decided to search for other framework that could do the job with less code, more inteligently and more easy to test, deploy. Tapestry match all our requirements and we are building with it today and thanks to tapestry we are finally sleeping, eating and weekending like human beings again.

23 09 2008
John Rico

Tapestry 5 is more a declarative model, Wicket is more a Imperative model, Both are very similar but with Tapestry you use more annotations with Wicket you use Java code.

With Tepestry 5 you define your components in the markup, With Wicket you use the HTML just as a structure for your components declared in Java code.

In my experience Wicket is more verbose Java code but good for refactoring, Tapestry 5 is tight code but watch out with refactoring better use a good IDE for it. With Wicket any IDE it is nice.

The community of both are very nice and friendly.
There is even some people propose to combine Tapestry and Wicket because are somewhat similar but will never happen because the little detail i wrote above. And also it is great to have choices.

Right now I use both, Some things I use Tapestry and another Wicket. I dropped JSF, Spring MVC and Struts already. With Tapestry and Wicket My team is happy again.


26 06 2009
Alan Earl

It depends on your decision!

For me as long as it is open source under GPL.
It is the BEST….

But I like Tapestry 5 soooo much .

1. No Proper Books in the market.
2. No Backward Compatability.

It is the Java Framework that made me feel, Life is Easy & Fun.

Thanks Tapestry Developers …

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: