Book description
The J2EE(TM) Platform has become the technology of choice for developing professional e-commerce applications, interactive Web sites, and Web-enabled applications and services. Servlet and JSP(TM) technology is the foundation of this platform: it provides the link between Web clients and server-side applications. In this 2nd edition of the worldwide bestseller, the authors show you how to apply the latest servlet and JSP capabilities. Unlike other books that treat servlet or JSP technology in isolation, Core Servlets and JavaServer Pages provides a unified treatment, showing you when servlet technology is best, when the JSP approach is preferred, and when (and how) servlets and JSP should work together.
Part I provides exhaustive coverage of the servlet 2.4 specification. It starts with server configuration, basic syntax, the servlet life cycle, and use of form data. It moves on to applying HTTP 1.1, cookies, and session tracking. Advanced topics include compressing Web content, incrementally updating results, dynamically generating images, and creating shopping carts.
Part II gives an in-depth guide to JSP 2.0. It covers both the "classic" JSP scripting elements and the new JSP 2.0 expression language. It shows how to control the content type, designate error pages, include files, and integrate JavaBeans components. Advanced topics include sharing beans, generating Excel spreadsheets, and dealing with concurrency.
Part III covers two key supporting technologies: HTML forms and database access with JDBC(TM). It explains every standard HTML input element and shows how to use appropriate JDBC drivers, perform database queries, process results, and perform updates. Advanced topics include parameterized queries, stored procedures, and transaction control.
Design strategies include ways to integrate servlet and JSP technology, best practices for invoking Java code from JSP pages, plans for dealing with missing and malformed data, and application of the MVC architecture.
Handy guides walk you through use of three popular servlet and JSP engines (Apache Tomcat, Macromedia JRun, and Caucho Resin) and some of the most widely used database systems (MySQL, Oracle9i, Microsoft Access).
Volume 2 of this book covers advanced topics: filters, custom tag libraries, database connection pooling, Web application security, the JSP Standard Tag Library (JSTL), Apache Struts, JavaServer Faces (JSF), JAXB, and more.
The same clear step-by-step explanations that made the first edition so popular
Completely updated for the latest standards: servlets 2.4 and JSP 2.0
Hundreds of completely portable, fully documented,industrial-strength examples
Detailed treatment of Apache Tomcat, Macromedia JRun, and Caucho Resin Online access to all source code, available free for unrestricted use at the author's www.coreservlets.com web site.
Table of contents
- Copyright
- Acknowledgments
- Introduction
- 1. An Overview of Servlet and JSP Technology
-
I. Servlet Technology
-
2. Server Setup and Configuration
- 2.1. Download and Install the Java Software Development Kit (SDK)
- 2.2. Download a Server for Your Desktop
- 2.3. Configure the Server
- 2.4. Configuring Apache Tomcat
- 2.5. Configuring Macromedia JRun
- 2.6. Configuring Caucho Resin
- 2.7. Set Up Your Development Environment
- 2.8. Test Your Setup
- 2.9. Establish a Simplified Deployment Method
- 2.10. Deployment Directories for Default Web Application: Summary
- 2.11. Web Applications: A Preview
- 3. Servlet Basics
-
4. Handling the Client Request: Form Data
- 4.1. The Role of Form Data
- 4.2. Reading Form Data from Servlets
- 4.3. Example: Reading Three Parameters
- 4.4. Example: Reading All Parameters
- 4.5. Using Default Values When Parameters Are Missing or Malformed
- 4.6. Filtering Strings for HTML-Specific Characters
- 4.7. Automatically Populating Java Objects from Request Parameters: Form Beans
- 4.8. Redisplaying the Input Form When Parameters Are Missing or Malformed
-
5. Handling the Client Request: HTTP Request Headers
- 5.1. Reading Request Headers
- 5.2. Making a Table of All Request Headers
- 5.3. Understanding HTTP 1.1 Request Headers
- 5.4. Sending Compressed Web Pages
- 5.5. Differentiating Among Different Browser Types
- 5.6. Changing the Page According to How the User Got There
- 5.7. Accessing the Standard CGI Variables
- 6. Generating the Server Response: HTTP Status Codes
- 7. Generating the Server Response: HTTP Response Headers
-
8. Handling Cookies
- 8.1. Benefits of Cookies
- 8.2. Some Problems with Cookies
- 8.3. Deleting Cookies
- 8.4. Sending and Receiving Cookies
- 8.5. Using Cookies to Detect First-Time Visitors
- 8.6. Using Cookie Attributes
- 8.7. Differentiating Session Cookies from Persistent Cookies
- 8.8. Basic Cookie Utilities
- 8.9. Putting the Cookie Utilities into Practice
- 8.10. Modifying Cookie Values: Tracking User Access Counts
- 8.11. Using Cookies to Remember User Preferences
-
9. Session Tracking
- 9.1. The Need for Session Tracking
- 9.2. Session Tracking Basics
- 9.3. The Session-Tracking API
- 9.4. Browser Sessions vs. Server Sessions
- 9.5. Encoding URLs Sent to the Client
- 9.6. A Servlet That Shows Per-Client Access Counts
- 9.7. Accumulating a List of User Data
- 9.8. An Online Store with a Shopping Cart and Session Tracking
-
2. Server Setup and Configuration
-
II. JSP Technology
- 10. Overview of JSP Technology
-
11. Invoking Java Code with JSP Scripting Elements
- 11.1. Creating Template Text
- 11.2. Invoking Java Code from JSP
- 11.3. Limiting the Amount of Java Code in JSP Pages
- 11.4. Using JSP Expressions
- 11.5. Example: JSP Expressions
- 11.6. Comparing Servlets to JSP Pages
- 11.7. Writing Scriptlets
- 11.8. Scriptlet Example
- 11.9. Using Scriptlets to Make Parts of the JSP Page Conditional
- 11.10. Using Declarations
- 11.11. Declaration Example
- 11.12. Using Predefined Variables
- 11.13. Comparing JSP Expressions, Scriptlets, and Declarations
-
12. Controlling the Structure of Generated Servlets: The JSP page Directive
- 12.1. The import Attribute
- 12.2. The contentType and pageEncoding Attributes
- 12.3. Conditionally Generating Excel Spreadsheets
- 12.4. The session Attribute
- 12.5. The isELIgnored Attribute
- 12.6. The buffer and autoFlush Attributes
- 12.7. The info Attribute
- 12.8. The errorPage and isErrorPage Attributes
- 12.9. The isThreadSafe Attribute
- 12.10. The extends Attribute
- 12.11. The language Attribute
- 12.12. XML Syntax for Directives
- 13. Including Files and Applets in JSP Pages
- 14. Using JavaBeans Components in JSP Documents
-
15. Integrating Servlets and JSP: The Model View Controller (MVC) Architecture
- 15.1. Understanding the Need for MVC
- 15.2. Implementing MVC with RequestDispatcher
- 15.3. Summarizing MVC Code
- 15.4. Interpreting Relative URLs in the Destination Page
- 15.5. Applying MVC: Bank Account Balances
- 15.6. Comparing the Three Data-Sharing Approaches
- 15.7. Forwarding Requests from JSP Pages
- 15.8. Including Pages
-
16. Simplifying Access to Java Code: The JSP 2.0 Expression Language
- 16.1. Motivating EL Usage
- 16.2. Invoking the Expression Language
- 16.3. Preventing Expression Language Evaluation
- 16.4. Preventing Use of Standard Scripting Elements
- 16.5. Accessing Scoped Variables
- 16.6. Accessing Bean Properties
- 16.7. Accessing Collections
- 16.8. Referencing Implicit Objects
- 16.9. Using Expression Language Operators
- 16.10. Evaluating Expressions Conditionally
- 16.11. Previewing Other Expression Language Capabilities
-
III. Supporting Technology
- 17. Accessing Databases with JDBC
-
18. Configuring MS Access, MySQL, and Oracle9i
- 18.1. Configuring Microsoft Access for Use with JDBC
- 18.2. Installing and Configuring MySQL
-
18.3. Installing and Configuring Oracle9i Database
- Download and Install Oracle9i
- Create a Database
- Create a Database with the Configuration Assistant
-
Create a Database Manually
- Set Up Database Directories
- Create an Initialization Parameter File
- Create a Password File
- Create an Oracle Service for the Database
- Declare the ORACLE_SID Value
- Connect to the Oracle Service as SYSDBA
- Start the Oracle Instance
- Create the Database
- Create a User Tablespace
- Run Scripts to Build Data Dictionary Views
- Create a User
- Install the JDBC Driver
- 18.4. Testing Your Database Through a JDBC Connection
- 18.5. Setting Up the music Table
-
19. Creating and Processing HTML Forms
- Default Web Application: Tomcat
- Default Web Application: JRun
- Default Web Application: Resin
- 19.1. How HTML Forms Transmit Data
- 19.2. The FORM Element
- 19.3. Text Controls
- 19.4. Push Buttons
- 19.5. Check Boxes and Radio Buttons
- 19.6. Combo Boxes and List Boxes
- 19.7. File Upload Controls
- 19.8. Server-Side Image Maps
- 19.9. Hidden Fields
- 19.10. Groups of Controls
- 19.11. Tab Order Control
- 19.12. A Debugging Web Server
-
Server Organization and Structure
- Tomcat
- JRun
- Resin
Product information
- Title: Core Servlets and JavaServer Pages™: Volume 1: Core Technologies, 2nd Edition
- Author(s):
- Release date: August 2003
- Publisher(s): Pearson
- ISBN: 0130092290
You might also like
book
Core Servlets and JavaServer Pages, Volume 2: Advanced Technologies, Second Edition
Java EE is the technology of choice for e-commerce applications, interactive Web sites, and Web-enabled services. …
book
Core Java™ 2 Volume I - Fundamentals, Seventh Edition
Completely revised and up-to-date coverage of Generic programming, restrictions and limitations, type bounds, wilcard types, and …
book
Core Servlets and JavaServer Pages™
Practical guide to using Java for Web-enabled applications and dynamic Web sites In-depth coverage of the …
book
Core Java, Volume I Fundamentals, 11th Edition
The #1 Java Guide for Serious Programmers: Fully Updated for Java SE 9, 10 & 11 …