O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Core Web Programming, Second Edition

Book Description

One-stop shopping for serious Web developers!

  • The worldwide best seller for serious Web developers—now 100% updated!

  • In-depth HTML 4/CSS, Java 2, Servlets, JSP, XML, and more!

  • Industrial-strength code examples throughout!

The authoritative guide to every technology that enterprise Web developers need to master, from HTML 4 to Java 2 Standard Edition 1.3, servlets to JavaServer Pages, and beyond. Core Web Programming, Second Edition brings them all together in the ultimate Web development resource for experienced programmers.

HTML 4: In-depth, practical coverage of HTML document structure, block-level and text-level elements, frames, cascading style sheets, and beyond.

Java 2: Basic syntax, object-oriented design, applets and animation, the Java Plug-In, user interface development with Swing, layout managers, Java2D, multithreading, network programming, database connectivity, and more.

Server-Side Java: Servlets, JSP, XML, and JDBC-the foundations of enterprisedevelopment with Java. Advanced topics include JSP custom tag libraries,combining servlets and JSP (MVC), database connection pooling, SAX, DOM, and XSLT processing, and detailed coverage of HTTP 1.1.

JavaScript: Dynamic creation of Web page content, user event monitoring, HTML form field validation, and more. Includes a complete quick reference guide.

This book's first edition is used in leading computer science programs worldwide, from MIT to Stanford, UC Berkeley to Princeton, UCLA to Johns Hopkins. Now, it's been 100% updated for today's hottest Web development technologies—with powerful new techniques, each with complete working code examples!

Every Core Series book:

  • DEMONSTRATES practical techniques used by professional developers

  • FEATURES robust, thoroughly tested sample code and realistic examples

  • FOCUSES on the cutting-edge technologies you need to master today

  • PROVIDES expert advice that will help you build superior software

Core Web Programming delivers:

  • Practical insights for Web development with HTML, CSS, and JavaScript

  • Expert J2SE 1.3 coverage, from Swing and Java 2D to threading, RMI, and JDBC

  • Fast-track techniques for server-side development with servlets, JSP, and XML

  • Hundreds of real-world code examples, including complete sample applications

Table of Contents

  1. Copyright
  2. Introduction
  3. Acknowledgments
  4. The HyperText Markup Language
    1. Designing Web Pages with HTML 4.0
      1. The HyperText Markup Language
      2. HTML 4.0 and Other HTML Standards
      3. Steps to Publish a Document on the Web
      4. The Basic Structure of HTML Documents
      5. HEAD—High-Level Information About the Page
      6. BODY-Creating the Main Document
      7. Summary
    2. Block-Level Elements in HTML 4.0
      1. Headings
      2. Basic Text Elements
      3. Numbered, Bulleted, and Indented Lists
      4. Tables
      5. Fill-Out Forms
      6. Miscellaneous Block-Level Elements
      7. Summary
    3. Text-Level Elements in HTML 4.0
      1. Physical Character Styles
      2. Logical Character Styles
      3. Specifying Hypertext Links
      4. Embedded Images
      5. Client-Side Image Maps
      6. Embedding Other Objects in Documents
      7. Controlling Line Breaks
      8. Summary
    4. Frames
      1. Frame Document Template
      2. Specifying Frame Layout
      3. Specifying the Content of Frame Cells
      4. Targeting Frame Cells
      5. Solving Common Frame Problems
      6. Inline Frames
      7. Summary
    5. Cascading Style Sheets
      1. Specifying Style Rules
      2. Using External and Local Style Sheets
      3. Selectors
      4. Cascading: Style Sheet Precedence Rules
      5. Font Properties
      6. Foreground and Background Properties
      7. Text Properties
      8. Properties of the Bounding Box
      9. Images and Floating Elements
      10. List Properties
      11. Standard Property Units
      12. Layers
      13. Summary
  5. Java Programming
    1. Getting Started with Java
      1. Unique Features of Java
      2. Myths About Java
      3. Java Versions
      4. Getting Started: Nuts and Bolts
      5. Some Simple Java Programs
      6. Summary
    2. Object-Oriented Programming in Java
      1. Instance Variables
      2. Methods
      3. Constructors and the “this” Reference
      4. Destructors
      5. Overloading
      6. Public Version in Separate File
      7. Javadoc
      8. Inheritance
      9. Interfaces and Abstract Classes
      10. Packages, Classpath, and JAR Archives
      11. Modifiers in Declarations
      12. Summary
    3. Basic Java Syntax
      1. Rules of Syntax
      2. Primitive Types
      3. Operators, Conditionals, Iteration
      4. The Math Class
      5. Input and Output
      6. Execution of Non-Java Programs
      7. Reference Types
      8. Strings
      9. Arrays
      10. Vectors
      11. Example: A Simple Binary Tree
      12. Exceptions
      13. Summary
    4. Applets and Basic Graphics
      1. What Are Applets?
      2. Creating an Applet
      3. An Example Applet
      4. The Applet Life Cycle
      5. Other Applet Methods
      6. The HTML APPLET Element
      7. Reading Applet Parameters
      8. HTML OBJECT Element
      9. The Java Plug-In
      10. Graphical Applications
      11. Graphics Operations
      12. Drawing Images
      13. Preloading Images
      14. Controlling Image Loading: Waiting for Images and Checking Status
      15. Summary
    5. Java 2D: Graphics in Java 2
      1. Getting Started with Java 2D
      2. Drawing Shapes
      3. Paint Styles
      4. Transparent Drawing
      5. Using Local Fonts
      6. Stroke Styles
      7. Coordinate Transformations
      8. Other Capabilities of Java 2D
      9. Summary
    6. Handling Mouse and Keyboard Events
      1. Handling Events with a Separate Listener
      2. Handling Events by Implementing a Listener Interface
      3. Handling Events with Named Inner Classes
      4. Handling Events with Anonymous Inner Classes
      5. The Standard Event Listeners
      6. Behind the Scenes: Low-Level Event Processing
      7. A Spelling-Correcting Textfield
      8. A Whiteboard Class
      9. Summary
    7. Layout Managers
      1. The FlowLayout Manager
      2. The BorderLayout Manager
      3. The GridLayout Manager
      4. The CardLayout Manager
      5. GridBagLayout
      6. The BoxLayout Manager
      7. Turning Off the Layout Manager
      8. Effective Use of Layout Managers
      9. Summary
    8. AWT Components
      1. The Canvas Class
      2. The Component Class
      3. Lightweight Components in Java 1.1
      4. The Panel Class
      5. The Container Class
      6. The Applet Class
      7. The ScrollPane Class
      8. The Frame Class
      9. Serializing Windows
      10. The Dialog Class
      11. The FileDialog Class
      12. The Window Class
      13. Handling Events in GUI Controls
      14. The Button Class
      15. The Checkbox Class
      16. Check Box Groups (Radio Buttons)
      17. Choice Menus
      18. List Boxes
      19. The TextField Class
      20. The TextArea Class
      21. The Label Class
      22. Scrollbars and Sliders
      23. Pop-up Menus
      24. Summary
    9. Basic Swing
      1. Getting Started with Swing
      2. The JApplet Component
      3. The JFrame Component
      4. The JLabel Component
      5. The JButton Component
      6. The JPanel Component
      7. The JSlider Component
      8. The JColorChooser Component
      9. Internal Frames
      10. The JOptionPane Component
      11. The JToolBar Component
      12. The JEditorPane Component
      13. Other Simple Swing Components
      14. Summary
    10. Advanced Swing
      1. Using Custom Data Models and Renderers
      2. JList
      3. JTree
      4. JTable
      5. Swing Component Printing
      6. Swing Threads
      7. Summary
    11. Concurrent Programming with Java Threads
      1. Starting Threads
      2. Race Conditions
      3. Synchronization
      4. Creating a Multithreaded Method
      5. Thread Methods
      6. Thread Groups
      7. Multithreaded Graphics and Double Buffering
      8. Animating Images
      9. Timers
      10. Summary
    12. Network Programming
      1. Implementing a Client
      2. Parsing Strings by Using StringTokenizer
      3. Example: A Client to Verify E-Mail Addresses
      4. Example: A Network Client That Retrieves URLs
      5. The URL Class
      6. WebClient: Talking to Web Servers Interactively
      7. Implementing a Server
      8. Example: A Simple HTTP Server
      9. RMI: Remote Method Invocation
      10. Summary
  6. Server-Side Programming
    1. HTML Forms
      1. How HTML Forms Transmit Data
      2. The FORM Element
      3. Text Controls
      4. Push Buttons
      5. Check Boxes and Radio Buttons
      6. Combo Boxes and List Boxes
      7. File Upload Controls
      8. Server-Side Image Maps
      9. Hidden Fields
      10. Grouping Controls
      11. Tab Order Control
      12. Summary
    2. Server-Side Java: Servlets
      1. The Advantages of Servlets Over “Traditional” CGI
      2. Server Installation and Setup
      3. Basic Servlet Structure
      4. The Servlet Life Cycle
      5. An Example Using Initialization Parameters
      6. The Client Request: Form Data
      7. The Client Request: HTTP Request Headers
      8. The Servlet Equivalent of the Standard CGI Variables
      9. The Server Response: HTTP Status Codes
      10. The Server Response: HTTP Response Headers
      11. Cookies
      12. Session Tracking
      13. Summary
    3. JavaServer Pages
      1. JSP Overview
      2. Advantages of JSP
      3. JSP Scripting Elements
      4. The JSP page Directive
      5. Including Files and Applets in JSP Documents
      6. Using JavaBeans with JSP
      7. Defining Custom JSP Tags
      8. Integrating Servlets and JSP
      9. 20.9 Summary
    4. Using Applets As Front Ends to Server-Side Programs
      1. Sending Data with GET and Displaying the Resultant Page
      2. A Multisystem Search Engine Front End
      3. Using GET and Processing the Results Directly (HTTP Tunneling)
      4. A Query Viewer That Uses Object Serialization and HTTP Tunneling
      5. Using POST and Processing the Results Directly (HTTP Tunneling)
      6. An Applet That Sends POST Data
      7. Bypassing the HTTP Server
      8. Summary
    5. JDBC
      1. Basic Steps in Using JDBC
      2. Basic JDBC Example
      3. Some JDBC Utilities
      4. Applying the Database Utilities
      5. An Interactive Query Viewer
      6. Prepared Statements (Precompiled Queries)
      7. Summary
    6. XML Processing with Java
      1. Parsing XML Documents with DOM Level 2
      2. DOM Example: Representing an XML Document as a JTree
      3. Parsing XML Documents with SAX 2.0
      4. SAX Example 1: Printing the Outline of an XML Document
      5. SAX Example 2: Counting Book Orders
      6. Transforming XML with XSLT
      7. XSLT Example 1: XSLT Document Editor
      8. XSLT Example 2: Custom JSP Tag
      9. Summary
  7. JavaScript
    1. JavaScript: Adding Dynamic Content to Web Pages
      1. Generating HTML Dynamically
      2. Monitoring User Events
      3. Mastering JavaScript Syntax
      4. Using JavaScript to Customize Web Pages
      5. Using JavaScript to Make Pages Dynamic
      6. Using JavaScript to Validate HTML Forms
      7. Using JavaScript to Store and Examine Cookies
      8. Using JavaScript to Interact with Frames
      9. Accessing Java from JavaScript
      10. Accessing JavaScript from Java
      11. Summary
    2. JavaScript Quick Reference
      1. The Array Object
      2. The Button Object
      3. The Checkbox Object
      4. The Date Object
      5. The Document Object
      6. The Element Object
      7. The FileUpload Object
      8. The Form Object
      9. The Function Object
      10. The Hidden Object
      11. The History Object
      12. The Image Object
      13. The JavaObject Object
      14. The JavaPackage Object
      15. The Layer Object
      16. The Link Object
      17. The Location Object
      18. The Math Object
      19. The MimeType Object
      20. The Navigator Object
      21. The Number Object
      22. The Object Object
      23. The Option Object
      24. The Password Object
      25. The Plugin Object
      26. The Radio Object
      27. The RegExp Object
      28. The Reset Object
      29. The Screen Object
      30. The Select Object
      31. The String Object
      32. The Submit Object
      33. The Text Object
      34. The Textarea Object
      35. The Window Object
      36. Summary
  8. Index