You are previewing Core JSP.
O'Reilly logo
Core JSP

Book Description

  • The experienced developer's guide to JavaServer Pages development!

  • Database access, XML support, JavaBean integration, and much more

  • Architecting JSP applications for maximum performance and maintainability

  • Includes several complete sample JSP applications such as an authentication framework, an email tag library, and a Database-to-XML/XSL conversion tool

  • Sun's JavaServer Pages technology gives developers a powerful cross-platform solution for dynamic Web application development without the drawbacks of previous approaches. In Core JSP, two leading enterprise developers show experienced developers exactly how to make the most of JSP technology—for database integration, XML applications, session tracking, and many other purposes. From coding fundamentals to effective JSP program design, you'll find it here—along with real-world sample code for HTML calendars, JNDI applications, LDAP-based authentication JavaBeansTM, database search forms, and more!

  • Make the most of scriptlets, expressions, declarations, actions and directives

  • Get under the hood with Sun's JSP engine: multithreading, persistence, implicit objects, and more

  • Understand JSP requests and responses—in depth

  • Track sessions and data: hidden frames and form fields, cookies, URL rewriting, and the HttpSession API

  • Integrate databases: JDBCTM, SQL, metadata, connection pooling, and more

  • Creating custom JSP actions (custom tags)

  • Optimize the performance of your JSP pages

  • Every Core Series book:

  • DEMONSTRATES how to write commercial quality code

  • FEATURES dozens of nontrivial programs and examples—no toy code!

  • FOCUSES on the features and functions most important to real developers

  • PROVIDES objective, unbiased coverage of cutting-edge technologies—no hype!

  • Core JSP delivers:

  • Practical insights for transforming dynamic web pages into full-fledged web applications

  • Hands-on coverage of integrating JSP and XML

  • Expert JavaBean Action techniques for integrating JavaBean business logic with JSP presentation logic

  • Extensive code examples—including several complete sample applications

  • Table of Contents

    1. Copyright
    2. Foreword
    3. Acknowledgments
      1. From Aaron
      2. From Damon
    4. 1. Introduction
      1. 1.1. A History of the Web
        1. Static Pages
        2. Dynamic Pages
          1. Common Gateway Interface
          2. Server APIs
          3. Client-side Scripting Solutions
          4. Server-side Scripting Solutions
          5. Java Servlets
      2. 1.2. JavaServer Pages
        1. Template Pages
        2. Static Data vs. Dynamic Elements
        3. A Simple JSP Page
        4. JavaServer Pages
      3. 1.3. The Power of Java
        1. Write Once, Run Anywhere
        2. The Java API
        3. Security and Safety
        4. Scalability
        5. Extensibility
        6. Components
      4. 1.4. Understanding HTTP
        1. The Basics of HTTP
        2. The HTTP Request
        3. The HTTP Response
    5. 2. The Scripting Elements
      1. 2.1. The Scriptlet Element
      2. 2.2. Expression Element Syntax
      3. 2.3. Declaration Element Syntax
      4. 2.4. Embedded Control-Flow Statements
        1. Decision-Making Statements
        2. Loop Statements
        3. Exception Statements
      5. 2.5. Comment Syntax
      6. 2.6. Scripting Elements Applied: Calendar.jsp
    6. 3. Actions and Directives
      1. 3.1. Action Element Syntax
        1. Id attribute
        2. Scope attribute
        3. Standard Actions
        4. The JavaBean Actions
          1. <jsp:useBean>
          2. <jsp:setProperty>
          3. <jsp:getProperty>
        5. The Resource Actions
          1. <jsp:include>
          2. <jsp:forward>
          3. <jsp:plugin>
      2. 3.2. Directives
        1. Directive Syntax
        2. The Page Directive
          1. The buffer and autoFlush Attributes
          2. The contentType Attribute
          3. The errorPage and isErrorPage Attributes
          4. The extends Attribute
          5. The import Attribute
          6. The info Attribute
          7. The isThreadSafe Attribute
          8. The language Attribute
          9. The session Attribute
        3. The Include Directive
          1. The include action vs. the include directive
        4. The Taglib Directive
    7. 4. The JSP Engine: Under The Hood
      1. 4.1. Behind the Scenes
        1. Recompiling
        2. The Servlet-JSP Relationship
      2. 4.2. Multithreading and Persistence
        1. Persistence
        2. The Dangers of Threads
        3. Thread Safety
          1. SingleThreadModel
          2. synchronized()
      3. 4.3. The Implicit Objects
        1. The out Object
        2. The request Object
        3. The response Object
        4. The pageContext Object
        5. The session object
        6. The application Object
        7. The config Object
        8. The page Object
        9. The exception Object
      4. 4.4. The JSP lifecycle
        1. jspInit()
          1. method signature: void jspInit()
        2. jspDestroy()
          1. method signature: void jspDestroy()
        3. JSP Lifecycle Overview
        4. The counter using jspInit() and jspDestroy()
      5. 4.5. A JSP Compiled
      6. 4.6. Performance Tuning the Servlet
        1. Avoid appending with concatenation
        2. Use syncronize() carefully
    8. 5. Retrieving Information
      1. 5.1. The Request
      2. 5.2. The HTTP Request and JSP
        1. Parameters
          1. Raw Parameter Methods
          2. Convenience Parameter Methods
        2. Header Information
        3. Cookies
        4. Attributes
        5. Server Information
    9. 6. Sending Information
      1. 6.1. Using the Response Object
        1. The HTTP Status
        2. The HTTP Headers
        3. Other Methods of the Response Object
      2. 6.2. Setting Cookies
        1. Building the Cookie
        2. Sending the Cookie
        3. Using Cookies
      3. 6.3. Handling Errors
    10. 7. Tracking Sessions
      1. 7.1. Tracking Data between Requests
        1. Hidden Form Fields
        2. A Brief Tutorial on JavaMail
        3. A Mail Form Example
        4. Hidden Frames
        5. URL Rewriting
        6. Cookies
      2. 7.2. The HttpSession API
        1. Basics
        2. Using the Session Object
        3. The Life of a Session
      3. 7.3. Sessions and Identity
        1. Security Concerns
    11. 8. JavaBeans
      1. 8.1. The Component Model
        1. The Component Model for JSP
      2. 8.2. JavaBeans
        1. JavaBean Conventions
          1. The Constructor
          2. Properties and Accessor Methods
          3. Visibility
          4. JavaBean Examples
        2. Other Requirements
          1. Packaging
          2. Using the serializable Interface
        3. Beyond the Requirements
          1. Indexed Properties
        4. Introspection
          1. Overriding Introspection
        5. Using the JavaBean in JSP
          1. JSP Type Conversions
          2. Avoiding JSP Type Conversions
          3. The Scope of a JavaBean
          4. JavaBeans and Thread Safety
      3. 8.3. An Authentication JavaBean
        1. What is JNDI?
          1. Naming
          2. Directory Services
          3. How JNDI Works
        2. What is LDAP?
        3. The LDAPAuthBean
      4. 8.4. Components and Component Frameworks
      5. 8.5. Enterprise JavaBeans
        1. Session Beans vs. Entity Beans
        2. Programming Restrictions for Enterprise Beans
    12. 9. Database Connectivity
      1. 9.1. What is JDBC?
        1. ODBC
        2. Object vs. Relational
      2. 9.2. Understanding the Relational Model
        1. SQL
          1. The SELECT Statement
          2. The INSERT Statement
          3. The UPDATE Statement
          4. The DELETE Statement
          5. More on SQL
      3. 9.3. JDBC
        1. Step 1: Specifying the Driver
        2. Step 2: Establishing the Database Connection
        3. Step 3: Making a Statement
        4. Step 4: Sending the Query
        5. Step 5: In Closing
        6. The ResultSet Object
      4. 9.4. JDBC and JSP
        1. Prepared Statements
        2. Connection Pooling
      5. 9.5. JDBC and JavaBeans
        1. MetaData
        2. Insert and Update
    13. 10. JSP and XML
      1. 10.1. XML 101
        1. XML Structure
        2. CDATA and PCDATA
      2. 10.2. JSP as XML Documents
        1. The JSP Format to XML Format Transformation
      3. 10.3. XSL 101: XSL, XSLT, and XPath
        1. Learning XSLT
        2. XML Parsers and XSLT Processors
      4. 10.4. Combining XML and XSLT
      5. 10.5. Generating XML from JSP
    14. 11. Custom Tags
      1. 11.1. Custom Tag Basics
        1. Custom Tag Syntax
        2. The Players
          1. The Tag Library and Tag Handlers
          2. The taglib Directive
          3. The Tag Library Descriptor
          4. Custom Tag Types
      2. 11.2. The Custom Tag API
        1. Special Methods and Constants for Custom Tags
        2. Understanding the Tag Library Descriptor File
        3. Special Packaging Considerations
      3. 11.3. Creating a New Custom Tag
        1. The Tag Library Descriptor
        2. Custom Tags in Action
      4. 11.4. Creating Composite Tags
        1. A Composite Tag Example
    15. 12. Designing And Deploying JSP Applications
      1. 12.1. Reducing Complexity with Decomposition
        1. Methods for Architecting JSP Components
          1. Using Dynamic Page Includes
          2. Using JavaBeans and Enterprise JavaBeans
            1. Advantages and Disadvantages of using JavaBeans with JSP
          3. Using Tag Libraries with JSP
            1. The Advantages and Disadvantages of Using Tag Libraries
        2. JSP Design Models
          1. Presentation Logic
          2. Controller Logic
          3. Application Logic
          4. Model I: Separating Presentation and Application Logic
          5. Model 2: Separating Controller and Presentation Logic
      2. 12.2. JSP Application Deployment
        1. ZIP, JAR, WAR, and EAR
        2. Support for WAR and EAR Files
          1. WAR Files 101
            1. web.xml: The Deployment Descriptor
        3. Sun DeployTool
        4. Which is the best strategy?
    16. 13. The Future
      1. The Impact of the J2EE
      2. JSP and GUI Tools
      3. XML, XML, and more XML
      4. Where do I go from here?
    17. A. JSP API QuickReference
      1. Classes in javax.servlet.jsp.*
        1. Other Classes and Interfaces
      2. Classes in javax.servlet.jsp.tagext.*
        1. Other Classes and Interfaces
    18. B. JSP Applications
      1. Allaire JRun 3.0
      2. ATG Dynamo Application Server
      3. BEA WebLogic 5.1
      4. Allaire JRun 3.0
      5. ATG Dynamo Application Server
      6. BEA WebLogic 5.1
      7. Bluestone Sapphire/Web
      8. Drumbeat 2000 JSP
      9. EasyThings Web Server
      10. Enhydra
      11. Forte for Java
      12. GemStone/J Application Server
      13. IBM WebSphere Application Server 3.0
      14. Inprise Application Server 4.0
      15. InstantOnline Basic for JSP
      16. Intalio Platform
      17. iPlanet Application Server 6.0
      18. iPlanet Web Server, Enterprise Edition 4.1
      19. iServer
      20. Jakarta Tomcat 3.1: JSP Reference Implementation
      21. Jetty
      22. jo!
      23. JSPExecutor
      24. LiteWebServer
      25. Mercator Web and Commerce Broker
      26. New Atlanta ServletExec 2.2
      27. Oracle Application Server 4
      28. Oracle Jdeveloper
      29. Orion Application Server
      30. PolyJSP
      31. PowerTier 6 for EJB
      32. Pramati Server for J2EE 1.0
      33. Resin 1.1
      34. RocketJSP 1.0
      35. SilverStream Application Server
      36. SJSP 1.1.5 (Sator JSP)
      37. SUN Java Web Server 2.0
      38. Sybase Enterprise Application Server
      39. Unify eWave Engine
      40. WAICoolRunner
      41. zJSP 0.3
    19. C. Sample Databases