Tapestry in Action
Howard M. Lewis Ship
  • March 2004
  • ISBN 9781932394115
  • 580 pages

...masterfully written, making this elegant framework accessible to all Java web developers.

Erik Hatcher, Java Development with Ant

Tapestry in Action is the definitive guide to the Tapestry approach: creating full-featured web apps by connecting framework components to economical amounts of application code. Many simple examples show you how to tackle common tasks such as form validation, application localization, client-side scripting, and synchronization between browser and app server. Later chapters discuss more advanced topics including creation of new components and integration with J2EE.

About the Technology

Many web development frustrations can be traced back to the underlying stateless HTTP protocol. Tapestry represents state and behavior as standard Java objects, methods and properties. That means state management and multithreading are handled by the framework, leaving you with just your application's business logic. Tapestry does more, you do less.

Table of Contents detailed table of contents




about this book

about the title

about the cover illustration

Part 1 Using basic Tapestry components

1. Introducing Tapestry

1.1. What are web applications?

1.2. What are Java servlets?

1.2.1. Understanding servlet multithreading

1.2.2. Managing server-side state

1.2.3. Using Struts with servlets

1.2.4. Understanding the limitations of servlets

1.3. Why do we need Tapestry?

1.3.1. What is a framework?

1.3.2. What is a component?

1.3.3. What is Tapestry?

1.3.4. Comparing Tapestry to Swing

1.4. Understanding Tapestry’s goals

1.4.1. Simplicity

1.4.2. Consistency

1.4.3. Efficiency

1.4.4. Feedback

1.5. How does Tapestry work?

1.5.1. What’s in a Tapestry application?

1.5.2. Tapestry’s Model-View-Controller (MVC) pattern

1.5.3. Tapestry classes

1.6. Using Spindle

1.7. Summary

2. Getting started with Tapestry

2.1. Introducing the Hangman application

2.1.1. Determining the application flow

2.1.2. Creating page mockups

2.1.3. Defining the domain objects

2.1.4. Defining the pages

2.2. Developing the Home page

2.2.1. Understanding the Home page specification

2.2.2. Rendering the Home page

2.2.3. Defining the Home page class

2.2.4. Examining the Visit object

2.3. Implementing the Home page using standard servlets

2.4. Developing the Guess page

2.4.1. Displaying the remaining guesses

2.4.2. Generating the guessed word display

2.4.3. Selecting guesses

2.5. Developing the Win and Lose pages

2.6. Configuring the web.xml deployment descriptor

2.7. Summary

3. Tapestry and HTML forms

3.1. Understanding HTML forms

3.2. Creating a simple login form

3.2.1. Implementing the Login page class

3.2.2. Using specified properties

3.3. Understanding the Form component

3.3.1. Developing forms without Tapestry

3.3.2. Developing forms with Tapestry

3.3.3. Handling form submissions

3.4. Using basic form control components

3.4.1. Understanding the essentials

3.4.2. The Checkbox component

3.4.3. Radio and RadioGroup components

3.4.4. Select and Option components

3.4.5. Submit and ImageSubmit components

3.5. Creating a to-do list

3.5.1. Defining the data object

3.5.2. Creating the ToDo HTML template

3.5.3. Specifying properties in the page specification

3.5.4. Initializing the toDoList property

3.5.5. Handling reordering

3.5.6. Deleting completed items

3.6. Summary

4. Advanced form components

4.1. Introducing the advanced form components

4.2. Creating drop-down lists with PropertySelection

4.2.1. Adding priority levels to the ToDo application

4.2.2. Updating the HTML template

4.2.3. Implementing the page class

4.2.4. Implementing the model

4.2.5. Using enums instead of integers

4.3. Recording data in the form with Hidden

4.4. Looping within a form using ListEdit

4.4.1. Using the ListEditMap

4.4.2. Using ListEdit in the ToDo application

4.5. Handling file uploads

4.6. Creating pop-up date selections using DatePicker

4.7. Summary

5. Form input validation

5.1. Validating user input

5.1.1. Using FieldLabels in conjunction with ValidFields

5.1.2. Using validators

5.1.3. Using validation delegates

5.1.4. Using helper beans

5.2. Building the Register page

5.2.1. Creating the Register HTML template

5.2.2. Creating the Register page specification

5.3. Validating input based on regular expressions

5.4. Customizing label and field decorations

5.5. Enabling client-side validation

5.6. Handling form-level validations

5.7. Using validation without ValidField

5.8. Summary

Part 2 Creating Tapestry components

6. Creating reusable components

6.1. Creating simple template components

6.2. Creating the component specification

6.2.1. Specifying the component’s Java class

6.2.2. Discarding the component’s body

6.2.3. Forbidding informal parameters

6.2.4. Declaring parameters

6.2.5. Reserving names

6.3. Creating the Digit and Scaffold components

6.3.1. Specifying the digit parameter

6.3.2. Using the digit parameter

6.3.3. Creating the template

6.3.4. Using the Digit component

6.3.5. Using the Scaffold component

6.4. Creating the Letter component

6.4.1. Specifying the Letter component

6.4.2. Implementing the Letter component

6.4.3. Using the Letter component

6.5. Building the Spell component

6.5.1. Implementing the Spell component

6.5.2. Using the Spell component

6.6. Building the Border component

6.6.1. Creating the Border template

6.6.2. Creating the Border specification

6.6.3. Using the Border component

6.7. Creating interactive, reusable components

6.7.1. Introducing the Pet Store image map

6.7.2. Specifying the DirectArea component

6.7.3. Implementing the DirectArea component

6.7.4. Using the DirectArea component

6.8. Using component libraries

6.8.1. Declaring libraries

6.8.2. Referencing library components

6.9. Packaging components into libraries

6.9.1. Creating the library specification

6.9.2. Creating the library specification

6.9.3. Creating the FormError component

6.9.4. Using the FormError component

6.10. Summary

7. Tapestry under the hood

7.1. Processing requests

7.2. Understanding the application servlet

7.2.1. Servlet request processing

7.2.2. Understanding server-side state

7.2.3. Managing server-side state in a cluster

7.3. Understanding the Tapestry engine

7.4. Understanding engine services

7.4.1. What’s the problem with application URLs?

7.4.2. How does Tapestry handle application operations?

7.4.3. Using the home service

7.4.4. Rendering pages with the page service

7.4.5. Linking to listener methods with the direct service

7.5. Page rendering in detail

7.5.1. Using markup writers

7.5.2. Going beyond HTML

7.5.3. Understanding the page-rendering sequence

7.5.4. Using page-rendering events

7.6. Loading and pooling pages

7.6.1. Retrieving pages from the pool

7.6.2. Creating new page instances

7.6.3. Returning pages to the pool

7.7. Using persistent page properties

7.8. Using specified properties

7.9. Localizing Tapestry applications

7.9.1. Using Java localization

7.9.2. Using Tapestry’s localization features

7.10. Summary

8. Advanced techniques

8.1. Creating new engine services

8.1.1. Defining a banner ad system

8.1.2. Defining the data model

8.1.3. Accessing the data model as an application extension

8.1.4. Implementing the BannerAd component

8.1.5. Implementing the banner service

8.1.6. Creating the library specification

8.1.7. Building a banner ad application

8.2. Client-side scripting

8.2.1. Defining the CreditCardField component

8.2.2. Working with the Body component

8.2.3. Creating the Tapestry script specification

8.2.4. Creating the CreditCardField specification

8.2.5. Creating the CreditCardField component

8.2.6. Using the component

8.3. Integrating with JavaServer Pages

8.3.1. Redirecting to a JSP

8.3.2. Linking JSPs to Tapestry pages

8.3.3. Submitting JSP forms into Tapestry

8.4. Summary

Part 3 Building complete Tapestry applications

9. Putting it all together

9.1. Introducing the Virtual Library

9.2. Performing searches

9.2.1. Changing the table sort order

9.2.2. Paging through the results

9.3. Logging in and registering

9.4. Borrowing books

9.5. Getting details about books and persons

9.5.1. Viewing book details

9.5.2. Viewing a person

9.6. Managing your books

9.6.1. Editing a book

9.6.2. Deleting a book

9.6.3. Returning books

9.6.4. Adding a new book

9.6.5. Editing your profile

9.6.6. Giving away books

9.7. Administering the Virtual Library

9.7.1. Editing users

9.7.2. Editing publishers

9.7.3. Transferring books

9.8. Summary

10. Implementing a Tapestry application

10.1. Looking at the application layers

10.2. Organizing EJB access

10.2.1. Handling authentication

10.2.2. Accessing Enterprise JavaBeans

10.2.3. Tracking user identity with the Visit object

10.2.4. Understanding page inheritance

10.3. Implementing the Search page

10.3.1. Identifying application-specific components

10.3.2. Referencing the engine

10.3.3. Specifying the page class and properties

10.3.4. Performing searches

10.4. Implementing the BookMatches page

10.4.1. Handling paging and column sorting

10.4.2. Using the Browser component

10.4.3. Executing queries and re-queries

10.5. Implementing the Browser component

10.5.1. Specifying Browser’s parameters

10.5.2. Getting results from the BookQuery bean

10.5.3. Rendering the Browser component

10.6. Implementing the ColumnSorter component

10.6.1. Creating the ColumnSorter HTML template

10.6.2. Specifying ColumnSorter parameters

10.6.3. Responding to the user

10.7. Implementing the Border component

10.7.1. Handling user login

10.7.2. Linking to MyLibrary

10.8. Authenticating the user

10.8.1. Remembering the user

10.8.2. Clearing the password field

10.8.3. Invoking the login operation

10.9.2. Displaying the Book on the ViewBook page

10.9.4. Displaying the Person

10.10. Editing a Book

10.10.1. Tracking the Book ID

10.10.2. Generating dynamic JavaScript

10.11. Giving books away

10.12. Editing the publishers

10.12.1. Constructing the EditPublishers template

10.12.2. Declaring properties for the EditPublishers page

10.12.3. Creating the ListEditMap

10.12.4. Updating the publishers

10.13. Editing the list of users

10.13.1. Creating the ListEditMap subclass

10.13.2. Handling the form submission

10.14. Creating the web deployment descriptor

10.14.1. Deploying web applications as root

10.14.2. Deploying an enterprise application as root

10.15. Wrapping it all up

Appendix A: Getting involved with Tapestry

Appendix B: Building the examples with Ant

Appendix C: Tapestry component reference

Appendix D: Tapestry specifications


What's inside

  • Tapestry's Component Object Model
  • How to write new components
  • How to configure third party components
  • Dynamic JavaScript integration
  • Form validation
  • Tapestry/JSP integration
  • Localization/internationalization
  • J2EE integration

About the reader

If you want to create great web applications using Tapestry and know Java (plus plain-vanilla HTML and a little XML), this book is for you.

About the author

A professional software developer with fifteen years of experience and a member of the Apache Software Foundation, Howard Lewis Ship is the creator and the principal architect of Tapestry.

placing your order...

Don't refresh or navigate away from the page.
print book $26.97 $44.95 pBook + PDF
Additional shipping charges may apply
Tapestry in Action (print book) added to cart
continue shopping
go to cart

eBook $28.79 $35.99 PDF only
Tapestry in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks