gamelan
Search EarthWeb
CodeGuru | Gamelan | Jars | Wireless | Discussions
Navigate developer.com
Architecture & Design  
Database  
Java
Languages & Tools
Microsoft & .NET
Open Source  
Project Management  
Security  
Techniques  
Voice  
Web Services  
Wireless/Mobile
XML  
Technology Jobs  

   Developer.com Webcasts:
  The Impact of Coding Standards and Code Reviews

  Project Management for the Developer

  Defining Your Own Software Development Methodology

  more Webcasts...




See the Winners!


Linked Data Planet Conference & Expo


Developer Jobs

Be a Commerce Partner
Shop
Disney World Tickets
Send Text Messages
Condos For Sale
Online Education
GPS Devices
Compare Prices
Home Improvement
Holiday Gift Ideas
Compare Prices
Computer Deals
Imprinted Gifts
SMS Gateway
Logo Design Custom

 


Heroes Happen Here Launch Events
Attend the upcoming launch of three powerful new products, take a test drive, meet the teams, and leave with promotional copies of Windows Server 2008, Microsoft SQL Server 2008, and Microsoft Visual Studio 2008. Register here. »

 
Install What You Need with Windows Server 2008
Windows Server 2008 is Microsofts most full-featured server operating system yet, so it's ironic that one of its most exciting new features is an install option that cuts out most of the other features. Paul Rubens explores why a Server Core installation makes a great deal of sense in many instances. »

 
Simplify Big Business IT for Small and Midsize Companies
Windows Small Business Server 2008 and Windows Essential Business Server 2008 deliver all-in-one solutions to help fuel growth for customers and partners. »

 
Q&A with Bob Muglia: Senior VP, Server and Tools Division
Bob Muglia, senior vice president, Server and Tools Division, discusses Microsofts new interoperability principles and the steps the company is taking to increase the openness of its products. »

 
Q&A with Lutz Ziob, GM of Microsoft Learning
Lutz Ziob, the general manager of Microsoft Learning, talks about how IT professionals can become certified heroes within their enterprises by getting trained and certified in Windows Server 2008. »
Related Article -
Apache Struts Framework: The Big Picture
Working with the WebWork Framework
Modern Java Frameworks for Web Development
Developer News -
SaaS Tool Offers Custom Database Development    May 9, 2008
Microsoft’s Automated Agent: Can We Talk?    May 7, 2008
Borland Finally Sells CodeGear    May 7, 2008
Red Hat Heads For The JON 2.0    May 7, 2008
Free Tech Newsletter -

Project Management Guide: Developing a Web Site. Best Practices, Tips and Strategies. Download Exclusive eBook Now.

Weaving the Tapestry Framework
By Vlad Kofman

Go to page: 1  2  Next  

In a continuation of my series of articles about Java Web development frameworks, this article will look at the Tapestry framework. Because Tapestry is a rather large framework, one article is not enough to cover most of its features. I decided to split the discussion about Tapestry into two parts. In this first part, I will focus on the configuration of the framework in an enterprise-level IDE such as JBuilder 2005 and prepare the groundwork for a working example in the second part. I will also describe the structure of the framework and its main features in this article, and concentrate on more specific features and details in the second part.

Background of Tapestry

Tapestry is an open-source framework for Web development written in Java. It competes with other frameworks such as Struts, WebWork, and Turbine to be the first choice of Web developers as an application framework. It was developed by Howard Lewis Ship and is part of Jakarta project at Apache Software Foundation.

Tapestry is not like the other Web development frameworks, not only in terms of its structure and APIs but also in terms of the development process. It uses a component object model to represent the pages of a Web application. Working with Tapestry feels more like developing a desktop application with Graphical User Interface (GUI) widgets or java Swing components. Under the hood framework is written cleverly enough to make coding a Web application feel as a desktop application development. The framework does a tremendous amount of work behind the scenes and hidden from the developers, such as object pooling, multi threading, listener callbacks, garbage collections, session state, rendering, and other processes.

At first glance, Tapestry may appear to be overly complex and resource intensive; however, it actually is not. Most of the components are cached or reused and structure is intuitive for any developer who has worked with Swing or a similar GUI toolkit. The framework also uses XML intensively.

Tapestry implements the Model-View-Controller (MVC) paradigm not only for the overall separation of logic and presentation at the framework level, but also on the level of its individual components such as tables or forms, as I will explain in the next section. Additionally, numerous main components are implemented in terms of public interfaces to give developers a great deal of flexibility in using the framework.

Tapestry also offers a built-in logging mechanism that is excellent. It is extremely flexible and provides a wealth of information.

Here is a short description of the framework from the Apache site:

Tapestry reconceptualizes Web application development in terms of objects, methods, and properties instead of URLs and query parameters.

Tapestry is an alternative to scripting environments such as JavaServer Pages or Velocity. Tapestry goes far further, providing a complete framework for creating extremely dynamic applications with minimal amounts of coding.

Tapestry's approach, using a component object model similar to a traditional GUI, provides the following benefits:

  • Very high level of reuse, within and between projects
    Everything in Tapestry is a reusable component
  • Frees developers from writing boring, buggy code
    Code in terms of objects, methods, and properties, not URLs and query parameters
  • Allows applications' complexity to scale well
    Framework does all the URL building and message dispatching, transparently
  • Easy Internationalization/Localization
    Framework selects localized version of text, templates, and images
  • Extremely robust applications
    Less code is less bugs
    Sophisticated built-in exception reporting
    Line precise error reporting
  • Easy team integration
    Graphic designers and Java developers can work together without having to know each other's jobs

Tapestry components are a combination of a specification file (in XML), an HTML template, and a Java class (extending a framework class, with simple additions). Tapestry components are combined together to form larger components or complete Tapestry pages.

Structure of the Framework

"The goal of Tapestry is to eliminate most of the coding in a Web application. Under Tapestry, nearly all code is directly related to application functionality, with very little "plumbing." If you have previously developed a Web application using PHP, Microsoft Active Server Pages, JavaServer Pages, or Java Servlets, you may take all the plumbing for granted: writing servlets, assembling URLs, parsing URLs, managing objects inside the HttpSession, and so forth. Tapestry takes care of nearly all of that, for free. It allows for the development of rich, highly interactive applications." (Kevin C. Dorff, Tapestry online tutorial)

Similar to other Web development frameworks, Tapestry is configured via a set of XML property files and other resource files. There is a main [your-app-name].application config file, a set of custom application specific "jwc" and "page" resource files, and a traditional controller Servlet. But, this is where the resemblance to other MVC frameworks ends. A concept of Application Engine, a view rendering process, and templates makes Tapestry feel very different and stand our from the pack.

Every HTML page that the user sees is rendered from a template by the application engine that is initialized per user session. Additionally, view objects follow an MVC pattern and have data models with states that can be changed. For example, forms can have listeners attached to them or tables could be "restored" to a previous state.

Setup and Configuration

Before I discuss the inner working and the main components of the framework, I want to talk about the development environment and its setup.

For this article and the example in the second part, I'm using BEA WebLogic application server, JBuilder 2005 as the development IDE, and a free MySQL database for my database needs. Because J2EE has a standardized WAR and EAR packaging structure, you may use any other application server such as Apache Tomcat, any other IDE such as very popular and free Eclipse and any other database. Assuming you are savvy enough with using other tools and can comfortably create a WAR module, get it running on an application server, and connect to a database, all of my examples should work with minimal changes. But, descriptions and screenshots will reference my environment.

Note: As of this writing, Tapestry is up to version 3.0.3 and MySQL database at version 4.1 with Connector/J mysql-connector-java-3.1.11-bin.jar.

To set up Tapestry, download it at http://jakarta.apache.org/tapestry/downloads.html.

Create a new Project (call it Tapestry) in JBuilder and add Tapestry and MySQL connection libs into the project class-path.

Assuming you have installed and configured BEA WebLogic with JBuilder, assign a server to the project.

Go to page: 1  2  Next  


Tools:
Add www.developer.com to your favorites
Add www.developer.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed


Enterprise Java Archives

Intel Go Parallel Portal: Translating Multicore Power into Application Performance
Flash Demo: Learn how IBM Information Server Blade is easy to manage, highly scalable and efficient.
Five Trends for Application Development. Download Your Complimentary Report. Exclusive. Act Now.
Guide to Developing a Web Site. Best Practices, Tips and Strategies. Download Exclusive eBook Now.
Learn about expanding business opportunities for the reseller channel. Visit IT Channel Planet.



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES