JavaServer Pages, 2/e

Larne Pekowsky

  • 出版商: Addison Wesley
  • 出版日期: 2003-08-22
  • 售價: $1,510
  • 貴賓價: 9.5$1,435
  • 語言: 英文
  • 頁數: 368
  • 裝訂: Paperback
  • ISBN: 0321150791
  • ISBN-13: 9780321150790





Since being introduced in 1999, JavaServer Pages™ (JSP) have become a popular and important technology for building dynamic, interactive, content-rich Web sites. JavaServer Pages™, Second Edition is a hands-on guide to working with JSP, offering the easiest and most efficient ways for non-programmers and Web designers to create sophisticated, dynamic sites. Programmers can also utilize this book to independently create new dynamic components. This second edition covers the latest release of the JSP specification (2.0), many standard extensions to JSPs, and a number of best practices that have been developed since the publication of the first edition.

This book also offers overviews of some related technologies, including:

  • JavaBeans™
  • Servlets
  • JavaServer Pages Standard Tag Library (JSTL)
  • Jakarta Struts
  • Databases

    JavaServer Pages™, Second Edition contains all the information necessary to start writing JSP--for anyone who has a computer and can write HTML. It includes practical, Java-based techniques for maintaining and personalizing information-rich Web sites, as well as examples based on Jakarta Struts, the new JSP toolkit. Recent updates provide a number of new tools and techniques that will allow readers to get the most productivity from JSPs, with the least amount of effort.

    Also included is a CD-ROM containing everything you need to get started. The tools, which are free, open-source, stable, secure, and run on pretty much every platform, are powerful enough to serve even a mid-sized Web site without problems. Contents of the CD-ROM include: Tomcat™, the open-source reference implementation of the latest JSP and Servlet specification; useful libraries such as the JavaServer Pages Standard Tag Library (JSTL) and Struts; Hsqldb, a self-contained, 100 percent pure Java database; all the code examples from the book; and a number of Java beans, providing ready-to-use components for many of the tasks frequently needed on a dynamic Web page.

  • Table of Contents



    1. Introduction.

    A Brief History of the Web.

    Basic Dynamic Page Generation.

    Solving CGI Problems.

    Speeding up CGI.

    Separating HTML from Code.

    Servlets and JavaServer Pages.

    Welcome to Java News Today.

    Trying the Examples.

    2. Simple JSPs.

    Removing Text from a JSP.

    JSP Errors.

    Including Text in a JSP.

    The Phases of a JSP.

    Creating Custom Error Pages.

    Java News Today.

    Summary and Conclusions.

    Tags Learned in This Chapter.

    3. Using Beans.

    Splitting Big Tasks into Manageable Pieces.

    Defining Beans.

    JavaBean Tags.

    Getting a Property.

    Setting Properties.

    Making Data Available Throughout an Application.

    The Page Scope.

    The Request Scope.

    The Session Scope.

    The Application Scope.

    Special Actions When Beans Are Created.

    Making Beans Last Forever.

    Java News Today and Beans.

    Future Directions.

    Summary and Conclusions.

    Tags Learned in This Chapter.

    4. The Standard Tag Library.

    Tag Libraries.

    Tags with Bodies.

    Dynamic Attributes in Tags.

    Displaying Expressions.

    Formatting Output.

    Compound Data in the Expression Language.

    Repeating a Section of a Page.

    Optionally Including Sections of a Page.

    Browser Detection.

    Combining Tags.

    Selecting among Multiple Choices.

    Summary and Conclusions.

    Tags Learned in this Chapter.

    5. Java News Today: Part I.

    The Beans.

    The Header.

    The Left-Hand Navigation.

    The Login Page.

    The Quiz Result Page.

    The Section Page.

    The Article Page.

    The Remaining Pages.

    Summary and Conclusions.

    Tags Learned in this Chapter.

    6. Databases.

    A Quick Introduction to Databases.

    A Language for Databases.

    Using SQL Directly from JSPs.

    Inserting Data from JSPs.

    SQL and Beans.

    Summary and Conclusions.

    Tags Learned in This Chapter.

    7. Java News Today: Part 2.

    Designing the Tables.

    Adding Articles.

    User Pages.

    Other User Preferences.


    Summary and Conclusions.

    8. Working with XML.

    A Brief Introduction to XML.

    Using XML in JSPs.

    Selecting Data from an XML Document.

    Processing XML in JSPs.

    Formatting XML.

    Java News Today and XML.

    Summary and Conclusions.

    Tags Learned in this Chapter.

    9. A Small Cup of Java.



    Storing Values.

    Method Calls.

    Conditionally Evaluating Code.

    Evaluating the Same Code Multiple Times.

    Grouping Code.

    Handling Errors.

    Modeling a Problem with Objects.

    Objects in Java.

    Building Objects from Classes.

    Sometimes Nothing Is Something.

    Building Classes from Other Classes.


    Creating Groups of Classes and Interfaces.

    Using Java in JSPs.

    Database Access from Java.

    Summary and Conclusions.

    10. Writing Beans.

    How Beans Are Implemented.

    Automatic Type Conversion.

    How Beans Work.

    Bean Serialization.


    Special Events.

    Bean Errors.

    Summary and Conclusions.

    11. Servlets.

    The Servlet Life Cycle.

    The Servlet Class Hierarchy.

    More about Requests.

    More about Responses.

    Convenience Methods.

    Servlet Events.

    Forwarding and Including Requests.

    Using Scopes from Servlets.

    Using Beans from Servlets.

    The JSP Classes.

    Intercepting Requests.

    Summary and Conclusions.

    12. The Controller.

    Some Common Controller Tasks.

    Support for Controllers: Struts.

    Using Struts.

    Providing Security.

    Struts and JNT.

    Summary and Conclusions.

    13. Creating New Tag Libraries.

    The Tag Life Cycle.

    Tags without Bodies.

    Tags with Bodies.

    Using the Expression Language.

    JSPs as Custom Tags.

    Summary and Conclusions.

    14. Advanced Topics.

    Declaring Variables and Methods.

    Extending Different Classes.

    Returning Other Kinds of Data.


    Avoiding Thread Problems.

    Using Threads.

    Advanced Error Handling.

    Summary and Conclusions.

    Appendix A. Summary of Tags.

    Built-in Tags.

    Core Tags.

    Format, Parsing, and Internationalization Tags.

    SQL Tags.

    XML Tags.

    Appendix B. Configuring a Web Application.

    Layout of the Directories.

    The Web.xml File.