Tapestry Developer's Guide Howard Lewis Ship Tapestry Developer's Guide Howard Lewis Ship Copyright © 2000, 2001, 2002, 2003 the Apache Software Foundation
Total Page:16
File Type:pdf, Size:1020Kb
Tapestry Developer's Guide Howard Lewis Ship Tapestry Developer's Guide Howard Lewis Ship Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation Table of Contents 1. Introduction ............................................................................................................................1 Scripting vs. Components ..................................................................................................... 1 Interaction .........................................................................................................................4 Security .............................................................................................................................5 Web Applications ................................................................................................................ 5 Features ............................................................................................................................6 2. JavaBeans and Properties .......................................................................................................... 8 JavaBeans ..........................................................................................................................8 JavaBeans Properties ........................................................................................................... 8 Property Paths .................................................................................................................. 10 Object Graph Navigation Library ......................................................................................... 10 3. Tapestry Components ............................................................................................................. 11 Parameters and Bindings .................................................................................................... 11 Connected Parameters ........................................................................................................ 12 Formal vs. Informal Parameters ........................................................................................... 14 Embedded Components ...................................................................................................... 14 HTML Templates .............................................................................................................. 15 Localizing sections of a template .................................................................................. 16 Components with Bodies ............................................................................................ 16 Tapestry and HTML Production ........................................................................................... 17 Implicitly removed bodies .......................................................................................... 17 Explicitly removed bodies .......................................................................................... 18 Limiting template content ........................................................................................... 18 Limits ..................................................................................................................... 19 Localization ..................................................................................................................... 19 Localization with Strings ............................................................................................ 19 Localization with Templates ........................................................................................ 20 Assets ............................................................................................................................. 20 Helper Beans .................................................................................................................... 21 4. Tapestry Pages ...................................................................................................................... 22 Page State ........................................................................................................................ 22 Persistent Page State .......................................................................................................... 23 EJB Page Properties .......................................................................................................... 24 Dynamic Page State ........................................................................................................... 25 Stale Links and the Browser Back Button .............................................................................. 27 Page Loading and Pooling .................................................................................................. 28 Page Localization .............................................................................................................. 30 Page Buffering ................................................................................................................. 31 Page Events ..................................................................................................................... 31 5. Application Engines and Services ............................................................................................. 34 Application Servlet ............................................................................................................ 34 Required Pages ................................................................................................................. 35 Server-Side State .............................................................................................................. 37 Stateful vs. Stateless .......................................................................................................... 37 Engine Services ................................................................................................................ 37 Logging .......................................................................................................................... 39 Private Assets ................................................................................................................... 40 6. Understanding the Request Cycle .............................................................................................. 41 Service URLs and query parameters ..................................................................................... 41 Page service ..................................................................................................................... 41 Action and Direct listeners .................................................................................................. 42 Direct service ................................................................................................................... 44 Action service .................................................................................................................. 45 iv Tapestry Developer's Guide Services and forms ............................................................................................................ 47 7. Designing Tapestry Applications .............................................................................................. 48 Persistent Storage Strategy .................................................................................................. 48 Identify Pages and Page Flow .............................................................................................. 48 Identify Common Logic ..................................................................................................... 48 Identify Engine Services ..................................................................................................... 49 Identify Common Components ............................................................................................ 50 8. Coding Tapestry Applications .................................................................................................. 51 Application Engine ............................................................................................................ 51 Visit Object ..................................................................................................................... 51 Operating Stateless ............................................................................................................ 51 Enterprise JavaBeans Support .............................................................................................. 52 Page classes ..................................................................................................................... 52 9. Designing new components ..................................................................................................... 53 Choosing a base class ......................................................................................................... 53 Parameters and Bindings .................................................................................................... 53 Persistent Component State ................................................................................................. 55 Component Assets ............................................................................................................. 55 10. Tapestry and JavaScript ......................................................................................................... 57 The Body component