You are previewing Advanced JavaServer Pages™.
O'Reilly logo
Advanced JavaServer Pages™

Book Description

  • Design and implement flexible, extensible, and maintainable applications with servlets and JSP technology

  • Master powerful authentication and internationalization techniques

  • Learn how to integrate industry-standard XML and XSLT with JSP technology

  • Use JSP technology-based templates to develop robust applications from modular components

  • Advanced JavaServer Pages delivers:

  • Web application design techniques based on JSP and servlets technology

  • Proven strategies for achieving enterprise-class robustness and scalability with JSP technology

  • Expert guidance on implementing JSP technology-based applications with reusable components

  • To fully exploit the power of JavaServer Pages technology in Web application development, based on J2EE technology, you need to master the sophisticated server-side techniques that David Geary presents in Advanced JavaServer Pages.

    Geary tackles JavaServer Pages technology with the same exhaustive, authoritative approach that made his Graphic Java books into worldwide best sellers. He presents in-depth coverage of advanced topics including:

  • Implementing custom JSP technology tags

  • Designing scalable and extensible Web applications

  • Using authentication to build secure JSP technology-based applications

  • Internationalizing JSP technology-based applications for global environments

  • Advanced JavaServer Pages features detailed chapters on internationalization, authentication, JSP technology templates, design, and XML. It concludes with a comprehensive case study that ties together key topics developed in the book and demonstrates how to integrate advanced techniques based on JSP technology. This book is a must-have resource for every developer of Java technology creating server-side applications with JSP technology and servlets.

    Table of Contents

    1. Copyright
      1. Dedication
    2. Preface
      1. What This Book Is About
      2. The Servlet and JSP APIs This Book Depends Upon
      3. How This Book's Code Was Tested
      4. This Book's Audience
      5. How This Book Was Written
      6. How To Use This Book
      7. This Book's Custom Tag Libraries
      8. This Book's Code
      9. Conventions Used in This Book
    3. Acknowledgments
    4. 1. CUSTOM TAG FUNDAMENTALS
      1. Using Custom Tags—The JSP File
      2. Defining Custom Tags—The TLD
      3. Implementing Custom Tags—Tag Handlers
      4. Specifying the TLD in WEB-INF/web.xml
      5. <taglib> and <tag>
      6. The Tag Life Cycle
      7. Thread Safety
      8. Tags with Attributes
      9. Accessing Page Information
      10. Error Handling
      11. The Tag Package
        1. The Tag Interface
        2. The TagSupport Class: Ancestors, Values, and IDs
      12. Tags with Bodies
      13. Conclusion
    5. 2. CUSTOM TAG ADVANCED CONCEPTS
      1. Body Tag Handlers
        1. The BodyTag Interface
        2. The BodyTagSupport Class
      2. Iteration
      3. Scripting Variables
        1. Storing Beans in Page Scope
        2. Specifying Scripting Variable Information
        3. Associating a Tag Handler and Scripting Variables
        4. Using Custom Tag IDs
      4. Body Content
        1. Understanding How Body Content Works
        2. Generating JavaScript
      5. Nested Tags
        1. Locating Ancestor Tags
        2. Sharing Data
      6. Conclusion
    6. 3. HTML FORMS
      1. Forms with Beans
        1. Transmission of Transmitting Form Data
        2. Textfields, Text Areas, and Radio Buttons
        3. Checkboxes and Options
      2. Validation
        1. Client-side Validation with JavaScript
        2. Server-side Validation with JSP
        3. Server-side Validation with Servlets
        4. Server-side Validation with Servlets and JSP Pages
      3. A Form Framework
        1. Façade Design Pattern for HTML Forms
        2. The Framework
        3. Selectable Elements
        4. Validation
      4. Custom Tags
      5. Conclusion
    7. 4. TEMPLATES
      1. Encapsulating Layout
        1. Sections, Regions, and Templates
      2. Optional Content
      3. Role-based Content
      4. Defining Regions Separately
      5. Nesting Regions
      6. Extending Regions
      7. Combining Features
      8. Region Tag Implementations
        1. The Beans
        2. The Tag Handlers
      9. Conclusion
    8. 5. DESIGN
      1. Model 1
      2. Model 2: An MVC Approach
      3. A Model 2 Example
        1. The Beans
        2. The Deployment Descriptor
        3. Successful Login Use Case
        4. Creating a New Account
      4. Conclusion
    9. 6. A MODEL 2 FRAMEWORK
      1. A Model 2 Framework
        1. The Action Interface
        2. The Action Factory
        3. Action Routers
        4. The Action Servlet
        5. Retrofitting the Original Model 2 Example
      2. Refining the Design
      3. Adding Use Cases
        1. Step #1: Implement a Password Hint Action
        2. Step #2: Implement a Password Hint JSP Page
        3. Step #3: Add Mappings to the Properties File
        4. Step #4: Modify the Login Failed JSP Page
      4. The Importance of Custom Tags
      5. JSP Scripts
      6. Conclusion
        1. Bibliography
          1. Object-Oriented Design:
          2. Model-View-Controller:
          3. Use Cases:
    10. 7. EVENT HANDLING AND SENSITIVE FORM RESUBMISSIONS
      1. Event Handling for a Model 2 Framework
      2. Sensitive Form Resubmissions
        1. Trapping Form Resubmissions with a Model 2 Framework
          1. Tokens As Used by a Listener
          2. Tokens As Used by a Programmer
        2. Trapping Form Resubmissions Without a Framework
      3. Conclusion
    11. 8. I18N
      1. Unicode
      2. Charsets
        1. Non-Latin-based JSP Pages
        2. Multilingual JSP Pages
      3. Locales
      4. Resource Bundles
        1. List Resource Bundles
        2. Using Constants for Resource Keys
        3. Property Resource Bundles
      5. Multiple Resource Bundles
        1. A Bundle Cache
      6. Formatting Locale-Sensitive Information
        1. Dates and Times
        2. Numbers, Currency, and Percents
        3. Messages
      7. Browser Language Preferences
        1. Detecting Locales
        2. Locating Resource Bundles
      8. Custom Tags
        1. A Message Tag
        2. A Format Tag
      9. Conclusion
    12. 9. SECURITY
      1. Servlet Authentication
        1. Principals and Roles
        2. Declarative Authentication
        3. Portability
        4. Types of Authentication
      2. Basic Authentication
      3. Digest Authentication
      4. Form-Based Authentication
      5. SSL and Client Certificate Authentication
      6. Customizing Authentication
        1. Resin
        2. Tomcat 4.0
      7. Web Application Security Elements
      8. Programmatic Authentication
      9. Conclusion
    13. 10. DATABASES
      1. Database Creation
      2. Data Sources
      3. Database Custom Tags
        1. The Query Tag
        2. The ColumnNames Tag
        3. The Columns Tag
        4. The Rows Tag
        5. The Release Tag
      4. Connection Pooling
        1. Using a Connection Pool
        2. Creating a Connection Pool
        3. Implementing a Simple Connection Pool
        4. A More Capable Resource Pool
      5. Prepared Statements
      6. Transactions
      7. Scrolling Through Result Sets
      8. Conclusion
    14. 11. XML
      1. Generating XML
        1. Generating XML with Beans
        2. Beans That Generate Their Own XML
        3. Generating Beans from XML
      2. Postprocessing XML
      3. Parsing XML
        1. Simple API for XML (SAX)
        2. SAX Custom Tags
        3. Document Object Model (DOM)
        4. DOM Custom Tags
      4. Transforming XML
        1. Use JSP and XSLT Together
        2. Using XSLT in a Custom Tag to Produce HTML
        3. Using XSLT to Produce JSP at Compile Time
        4. Using XSLT at Compile Time Vs. Runtime
      5. Using XPath
      6. Conclusion
    15. 12. A CASE STUDY
      1. The Fruitstand
        1. The Homepage
        2. Going Shopping
        3. The Storefront
        4. The Shopping Cart
        5. The Checkout
        6. The Purchase
      2. The Model 2 Framework
        1. The Model
          1. The Database
          2. The Beans
        2. The Views—JSP Pages and Templates
        3. The Controllers—Servlets and Actions
          1. Servlets
          2. Actions
      3. Internationalization
      4. Authentication
      5. HTML Forms
      6. Sensitive Form Resubmissions
      7. SSL
      8. XML and DOM
      9. Conclusion
    16. SERVLET FILTERS
      1. A Servlet Filter Example
      2. Conclusion