Architecture & DesignAdvanced Features of the Tapestry Framework

Advanced Features of the Tapestry Framework

In the first part of this article, I discussed the main structure of the Tapestry framework, as well as its setup and configuration in an enterprise scale development environment such as JBuilder 2005. In this article, I will further explore the features of the framework and discuss specific components and pre-build modules. A sample application that uses Tapestry is included for your reference as well.

Structure of the Framework

As discussed in the first part of the article, the Tapestry framework tries to hide all of the plumbing associated with coding a Web application by giving developers a solid API set that feels more like a desktop Graphical User Interface (GUI) or a Swing development toolkit. For instance, it is never necessary to write code to directly read HTTP parameters, or directly deal with session, request, response, JSPs, tags, and so forth.

Most modern Web frameworks come with pre-build modules to help with development process, simplify specific functions, or give developers more flexibility. Tapestry is no exception; in fact, it excels in this area. It comes with a cornucopia of pre-built modules that have all of their functionality working “out of the box.” I will elaborate on this later. In addition to providing a lot of APIs for the developer, Tapestry provides whole modules that try to do the most common tasks found in the Web application, such as file upload, date/calendar logic, table pagination, field validation, internalization, redirection, and even popup functionality. Among some of the more advanced modules that also come as standard functionality of Tapestry are data trees and charts.

At the time of this writing, Tapestry is at version 4. The class and interface hierarchy are fully developed and the code is stable. Most components also are finalized and production quality. The code for the framework is combined into several logical packages, each corresponding to a specific functionality or feature.

Here is a short list of the most interesting packages provided by the framework. The complete list is available in the references section as Appendix A.

I am assuming that you have set up the development environment as described in the first part and feel comfortable deploying Web applications on the application server. To run the application, unzip it into some directory and use the provided WAR file to deploy it on WebLogic.

Conclusion

In this article, I have covered some of the more advanced aspects of the Tapestry framework for Web development. I have expanded the sample project from the first part and built it into a real working application using some of the most popular and useful features of the framework.

Tapestry may not be for everyone because of its complexity and abundance of APIs, modules, and pre-packaged components. Its learning curve is definitely one of the longest comparing with the other frameworks, and its development style is fundamentally different from the other frameworks as well, but it certainly can be very rewarding if you put some time into it. If utilized properly, Tapestry can definitely shorten the development circle and reduce amount of coding in a Web application.

As a next step, I recommend looking at the online resources such as the Tapestry online tutorial and picking up any book about the framework.

Source Code

You can download the source code for this sample here. Compiling the sample requires Tapestry framework libraries. You can download those at
http://jakarta.apache.org/site/downloads/downloads_tapestry.cgi. Extract them into the “lib” folder under the JBuilder project.

References

Online

Books

  • Art of Java Web Development: Struts, Tapestry, Commons, Velocity, JUnit, Axis, Cocoon, InternetBeans, WebWork (Paperback) by Neal Ford,ISBN: 1932394060

Appendix A: Compete Tapestry Package List

org.apache.tapestry
org.apache.tapestry.asset
org.apache.tapestry.bean
org.apache.tapestry.binding
org.apache.tapestry.callback
org.apache.tapestry.components
org.apache.tapestry.contrib.components
org.apache.tapestry.contrib.ejb
org.apache.tapestry.contrib.form
org.apache.tapestry.contrib.informal
org.apache.tapestry.contrib.inspector
org.apache.tapestry.contrib.jdbc
org.apache.tapestry.contrib.link
org.apache.tapestry.contrib.palette
org.apache.tapestry.contrib.popup
org.apache.tapestry.contrib.table.components
org.apache.tapestry.contrib.table.components.inserted
org.apache.tapestry.contrib.table.model
org.apache.tapestry.contrib.table.model.common
org.apache.tapestry.contrib.table.model.ognl
org.apache.tapestry.contrib.table.model.simple
org.apache.tapestry.contrib.table.model.sql
org.apache.tapestry.contrib.tree.components
org.apache.tapestry.contrib.tree.components.table
org.apache.tapestry.contrib.tree.model
org.apache.tapestry.contrib.tree.simple
org.apache.tapestry.contrib.valid
org.apache.tapestry.engine
org.apache.tapestry.enhance
org.apache.tapestry.enhance.javassist
org.apache.tapestry.event
org.apache.tapestry.form
org.apache.tapestry.html
org.apache.tapestry.jsp
org.apache.tapestry.link
org.apache.tapestry.listener
org.apache.tapestry.multipart
org.apache.tapestry.pageload
org.apache.tapestry.pages
org.apache.tapestry.param
org.apache.tapestry.parse
org.apache.tapestry.record
org.apache.tapestry.request
org.apache.tapestry.resolver
org.apache.tapestry.resource
org.apache.tapestry.script
org.apache.tapestry.spec
org.apache.tapestry.util
org.apache.tapestry.util.exception
org.apache.tapestry.util.io
org.apache.tapestry.util.pool
org.apache.tapestry.util.prop
org.apache.tapestry.util.xml
org.apache.tapestry.valid
org.apache.tapestry.wml
org.apache.tapestry.wml.pages

About the Author

Vlad Kofman is a Senior System Architect working on projects under government defense contracts. He also has been involved with enterprise-level projects for major Wall Street firms and the U.S. government. His main interests are object-oriented programming methodologies and design patterns.

Latest Posts

Related Stories