Note: this page applies to the now-obsolete first edition of the book. For
the second edition, please see
http://www.corewebprogramming.com.
For more info, see
the reader reviews,
the on-line ordering page,
the source code archive (250+ Java classes,
200+ HTML/JavaScript docs presented in the book), or
a sample chapter in HTML ("Graphical User
Interface Controls" from the Java section).
- Real Code for Real Programmers.
- How This Book is Organized.
- Conventions.
- About the CD-ROM.
- Acknowledgments.
- About the Author.
- The HyperText Markup Language.
- HTML 3.2 and Other HTML Standards.
- HTML Specifications
- HTML Scripting and Dynamic HTML
- Publishing Your Document on the Web.
- Create the Document
- Put the Document on the Web
- Validate the Document
- The Basic Structure of HTML Documents.
- HTML Document Template
- Frames
- HEAD Elements.
- Required HEAD Element
- Optional HEAD Elements
- BODY--Creating the Main Document.
- Summary.
- Headings.
- Basic Text Sections.
- Basic Paragraphs
- Paragraphs with Whitespace Preserved
- Paragraphs with Interpretation of HTML Turned Off
- Indented Quotations
- Addresses
- Numbered, Bulleted, and Indented Lists.
- Numbered Lists
- Bulleted Lists
- Definition Lists
- Tables.
- The Basic Table Structure
- Defining Table Rows
- Table Headings and Data Cells
- Fill-Out Forms.
- Miscellaneous Block-Level Elements.
- Summary.
- Physical Character Styles.
- Logical Character Styles.
- Specifying Hypertext Links.
- Embedded Images.
- Animated GIFs
- The IMG Element
- Client-Side Image Maps: Creating Clickable Regions in
Embedded Images.
- Embedding Other Objects in Documents.
- Embedding Java Programs
- Embedding Video, Audio, and other Formats via Plugins
- Embedding ActiveX Controls
- Scrolling Text Banners
- Controlling Line Breaks.
- Summary.
- Frame Document Template.
- Specifying Frame Layout.
- Specifying the Content of Frame Cells.
- Targeting Frame Cells.
- Predefined Frame Names.
- _blank
- _top
- _parent
- _self
- Solving Common Frame Problems.
- Bookmarking Frames
- Printing Frames
- Updating Multiple Frame Cells Simultaneously
- Preventing Your Documents From Being Framed
- Specifying FRAMESETs with Only a Single Entry
- Creating Empty Frame Cells
- Inline Frames.
- Summary.
- Specifying Style Rules.
- Using Local and External Style Sheets.
- The STYLE Element and JavaScript Style Sheets
- External Style Sheets
- Importing Style Sheets Using "@import"
- Inline Style Specification
- Selectors.
- HTML Elements
- HTML Elements in Certain Contexts
- User-Defined Classes
- User-Defined IDs
- Anchor Pseudo Classes
- Typographical Pseudo Elements
- Cascading: Style Sheet Precedence Rules.
- Rules marked "important" have the highest priority
- Author's rules have precedence over reader's rules
- More specific rules have precedence over less specific rules
- In case of a tie, the last rule specified has
priority
- Font Properties.
- Foreground and Background Properties.
- Text Properties.
- Properties of the Bounding Box.
- Margins
- Borders
- Padding
- Bounding Box Display Types
- Images and Floating Elements.
- Properties of Lists.
- Standard Property Units.
- Layers.
- Specifying Layers Using the LAYER and ILAYER Elements.
- Specifying Layers Using Style Sheets.
- Layer Properties
- An Example
- Summary.
- Unique Features of Java.
- Java is Web-Enabled and Network Savvy
- Java is Cross-Platform
- Java is Simple
- Java is Object Oriented
- Java Has Lots of Powerful Standard Libraries
- Myths About Java.
- Java is Only for the Web
- Java is Cross-Platform
- Java is Simple
- Object-Oriented Programming is the One True Way
- All Software Should Be Developed in Java
- Java Versions.
- Which Version Should You Use?
- Getting Started: Nuts and Bolts.
- Install Java
- Install a Java-Enabled Browser
- Bookmark or Install the On-Line Java API
- Optional: Get an Integrated Development Environment
- Create and Run a Java Program
- Some Simple Java Programs.
- The Basic Hello World Application
- Command-Line Arguments
- The Basic Hello World (Wide Web) Applet
- Applet Customization Parameters
- Summary.
- Instance Variables.
- Methods.
- Constructors and the "this" Reference.
- Static Initialization Blocks
- Destructors.
- Overloading.
- Public Version in Separate File.
- Javadoc.
- Tagged Paragraphs
- Javadoc Command-Line Arguments
- Fixing Hypertext Links: The Images Subdirectory and
the Standard API
- Inheritance.
- Interfaces and Abstract Classes.
- Packages and the Classpath.
- Modifiers in Declarations.
- Visibility Modifiers
- Other Modifiers
- Summary.
- Primitive Types.
- Primitive-Type Conversion
- Operators.
- Arithmetic Operators
- Conditionals
- Loops
- The Math class.
- Constants
- General-Purpose Methods
- Trigonometric Methods
- BigInteger and BigDecimal
- Input and Output.
- Printing to Standard Output
- Printing to Standard Error
- Reading from Standard Input
- Executing Non-Java Programs.
- Reference Types.
- Java Argument-Passing Conventions
- The instanceof Operator
- Strings.
- Methods in the String Class
- Vectors.
- Example: A Simple Binary Tree.
- Arrays.
- Two-Step Array Allocation
- One-Step Array Allocation
- Multidimensional Arrays
- Exceptions.
- Basic Form
- Multiple Catch Clauses
- The Finally Clause
- Throwing Exceptions
- Unchecked Exceptions
- Summary.
- What are Applets?
- Creating an Applet.
- Java Template
- HTML Template
- An Example Applet.
- Automatic Redrawing
- Reloading Applets During Development
- Getting Standard Output
- The Applet Life Cycle.
- Other Applet Methods.
- The HTML APPLET Tag.
- Reading Applet Parameters.
- Reading Applet Parameters: An Example
- Graphical Applications.
- Graphics Operations.
- Drawing Operations
- Colors and Fonts
- Drawing Modes
- Coordinates and Clipping Rectangles
- Setting Line Thicknesses: The GraphicsUtil Class.
- Drawing Images.
- Loading Applet Images from Relative URLs
- Loading Applet Images from Absolute URLs
- Loading Images in Applications
- Preloading Images.
- Controlling Image Loading: Waiting for
Images and Checking Status.
- Summary.
- Handling Events in Java 1.02.
- Event-Handling Helper Methods in Java 1.02.
- Mouse Events
- Keyboard Events
- Focus Events
- Action Events
- An Event Recorder Using Java 1.02
- Java 1.02 Event Types.
- Performing Graphics Operations in Event-Handling Methods.
- Example: Whiteboard Applet
- A Better Whiteboard
- Handling Events in Java 1.1.
- Listeners and Adapters
- Inner Classes
- Low-Level Event Processing
- Event Listeners in Java 1.1.
- Summary.
- Canvas.
- Major Purposes
- Default LayoutManager: None
- Creating and Using
- Example: A Circle Component
- Example: An ImageLabel Class
- The Component Class.
- Lightweight Components in Java 1.1.
- Panel.
- Major Purposes
- Default LayoutManager: FlowLayout
- Creating and Using
- Example: Using a Panel for Grouping
- The Container Class.
- Lightweight Containers in Java 1.1.
- Applet.
- Major Purpose
- Default LayoutManager: FlowLayout
- Creating and Using
- ScrollPane.
- Major Purpose
- Default LayoutManager: None
- Creating and Using
- Example
- Frame.
- Major Purpose
- Default LayoutManager: BorderLayout
- Creating and Using: Option 1 -- A Fixed-Size Frame
- Creating and Using: Option 2 -- A Frame That Stretches
Depending on What It Contains
- Example: A Quittable Frame
- Example2: A Class that Can Be Run as an Applet or an
Application
- Menus
- Other Useful Frame Methods
- Serializing Windows.
- Writing a Window to Disk
- Reading a Window from Disk
- Example: A Saveable Frame
- Dialog.
- Major Purposes
- Default LayoutManager: BorderLayout
- Creating and Using
- Example: A Quit Confirmation Dialog
- FileDialog.
- Major Purpose
- Default LayoutManager: None
- Creating and Using
- Example: Displaying Files in a TextArea
- Window.
- Major Purpose
- Default LayoutManager: BorderLayout
- Creating and Using: Option 1 -- A Fixed-Size Window
- Creating and Using: Option 2 -- A Window That Stretches
Depending on What It Contains
- Example
- The ImageLabel Class.
- Major Purposes
- Creating and Using
- Example
- Source Code
- Summary.
- FlowLayout.
- FlowLayout Constructor Options
- Other FlowLayout Methods
- BorderLayout.
- BorderLayout Constructor Options
- Other BorderLayout Methods
- GridLayout.
- GridLayout Constructor Options
- Other GridLayout Methods
- CardLayout.
- CardLayout Constructor Options
- Other CardLayout Methods
- GridBagLayout.
- The GridBagConstraints Object
- Example
- GridBagLayout Constructor Options
- Other GridBagLayout Methods
- Turning Off the LayoutManager.
- Using Layout Managers Effectively.
- Use Nested Containers
- Turn Off the Layout Manager for Some Containers
- Use a Custom Layout Manager
- Adjust the Empty Space Around Components
- Writing a Custom LayoutManager.
- The LayoutManager Interface
- The LayoutManager2 Interface
- Example: RowLayout
- Summary.
Note: The entire contents of this chapter is
available on-line.
- Handling Action Events in GUI Controls.
- Processing Action Events in Individual Components in
Java 1.0
- Processing Action Events in Containers in Java 1.0
- Processing Action Events in Individual Components in
Java 1.1
- Processing Action Events in Other Objects in Java
1.1
- Buttons.
- Constructors
- Example
- Other Button Methods
- Handling Button Events
- An Image Button Class.
- Constructors
- Example
- Other ImageButton Methods
- Handling ImageButton Events
- Source Code
- Checkboxes.
- Constructors
- Example
- Other Checkbox Methods
- Handling Events
- Checkbox Groups (Radio Buttons).
- Constructors
- Example
- Other CheckboxGroup and Checkbox Methods
- Handling CheckboxGroup Events
- Choice Menus (Combo Boxes).
- Constructor
- Example
- Other Choice Methods
- Handling Choice Events
- List Boxes.
- Constructors
- Example
- Other List Methods
- Handling List Events
- TextFields.
- Constructors
- Example
- Other TextField Methods
- Handling TextField Events
- TextAreas.
- Constructors
- Example
- Other TextArea Methods
- Handling Events
- Labels.
- Constructors
- Example
- Other Label Methods
- Handling Events
- Scrollbars and Sliders.
- Constructors
- Example
- Other Scrollbar Methods
- Handling Scrollbar Events
- A Slider Class.
- Constructors
- Example
- Other Slider Methods
- Handling Slider Events
- Source Code
- Popup Menus.
- Constructors
- Example
- Other PopUpMenu Methods
- Handling PopUpMenu Events
- Summary.
- Starting Threads.
- Mechanism 1: Put behavior in a separate Thread object
- Mechanism 2: Pub behavior in the driver class, which
must implement Runnable
- Race Conditions.
- Synchronization.
- Synchronizing a section of code
- Synchronizing an entire method
- Thread Methods.
- Constructors
- Constants
- Methods
- Using Threads in Netscape 3.0x
- Thread Groups.
- Multi-Threaded Graphics and Double-Buffering.
- Redraw everything in paint
- Implement the dynamic part as a separate Component
- Have routines other than paint directly do drawing
operations
- Override update and have paint do incremental updating
- Double buffering
- Summary.
- Implementing a Client.
- Example: A Generic Network Client
- Parsing Strings Using StringTokenizer.
- The java.util.StringTokenizer Class
- Constructors
- Methods
- Example: An Interactive Tokenizer
- Example: A Client to Verify E-Mail Addresses.
- Example: A Network Client that Retrieves URLs.
- A Class to Retrieve a Given URI from a Given Host
- A Class to Retrieve a Given URL
- UrlRetriever Output
- The URL Class.
- Reading from a URL
- Other Useful Methods of the URL Class
- Implementing a Server.
- Example: A Generic Network Server
- Connecting NetworkClient and NetworkServer Together
- Example: A Simple HTTP Server.
- ThreadedEchoServer: Adding Multithreading
- RMI: Remote Method Invocation.
- Steps to Building an RMI Application
- A Simple Example
- Example: A Server for Numeric Integration
- JDBC: Java DataBase Connectivity.
- Database Calls: An Overview
- Example: A Simple Test Database
- Using Meta Data
- Prepared Statements
- Summary.
- Communicating with an HTTP Server.
- The Client Request
- The Server Response
- An Example Interaction
- The HTTP Request Line.
- HTTP Request Headers.
- The HTTP Response Status Line.
- HTTP Response Headers.
- Cookies: Storing Persistent Data on the Client.
- Cookie Syntax
- A Cookie Example
- Privacy and Security Issues
- The Response File.
- An Overview of Public-Key Cryptography.
- Encryption
- Digital Signatures
- Digitally Signed Encryption
- Digitally Signed Encryption with Delivery Verification
- Using Confirmation Messages to Break Encryption
- Breaking Encryption with Man-in-the-Middle Attacks
- Summary.
- Using HTML Forms to Talk to CGI Programs.
- The HTML FORM Element.
- FORM Input Elements.
- Submit Buttons
- Reset Buttons
- JavaScript Buttons
- Checkboxes
- Radio Buttons
- Textfields
- Password Fields
- Server-Side Image Maps
- Attached Files
- Hidden Fields
- Text Areas
- Combo Boxes and List Boxes
- ISINDEX.
- ISMAP -- Alternative Server-Side Image Maps.
- Using Java Applets to Send GET Data to CGI Programs.
- Sending Data via GET and Displaying the Resultant Page
- Sending Data via GET and Processing the Results
- Using Java Applets to Send POST Data to CGI Programs.
- Template for Reading POST Data
- Using POST to Implement a Weather Report Page
- Bypassing the HTTP Server and Using Sockets Directly.
- Summary.
Note: for much more up-to-date information,
please see Core Servlets and JavaServer Pages.
The complete text is available online in PDF for free access, and all source code
is freely accessible as well.
- The CGI Interaction Process.
- Reading GET Data: The QUERY_STRING Variable.
- The Standard CGI Environment Variables.
- Passing Variables as Named Parameters
- Summary of CGI Variables
- CGI Command-Line Arguments.
- Handling ISINDEX.
- Reading POST Data.
- Parsing the Query Data.
- Breaking Up the Query String.
- Decoding URL-Encoded Values.
- Building a Look-Up Table for Query Data.
- Parsing Query Data: An Example.
- Using Cookies.
- Server-Side Java.
- Using Servlets
- A Servlet to Help Select Colors
- The HttpServletRequest Class
- The HttpServletResponse Class
- Filtering URLs Using Servlets
- Other CGI Alternatives.
- Server APIs
- Server-Side Includes
- LiveWire: Server-Side JavaScript
- JDBC and Direct Socket Connections for Applets
- The WebObjects Adaptor
- Summary.
- Generating HTML Dynamically.
- Compatibility with Multiple Browsers
- Monitoring User Events.
- Basic JavaScript Syntax.
- Dynamic Typing
- Function Declarations
- Objects and Classes
- Arrays
- Using JavaScript to Customize Web Pages.
- Avoiding Incompatibility When Using Extensions
- Setting Attribute Values with JavaScript
- Adjusting the Browser Window Size
- Determining if Plugins are Available
- Using JavaScript to Make Pages Dynamic.
- Modifying Images Dynamically
- Moving Layers
- Using JavaScript to Validate CGI Forms.
- Checking Values Individually
- Checking Values When Form is Submitted
- Using JavaScript to Store and Examine Cookies.
- Using JavaScript to Interact with Frames.
- Directing a Particular Frame to Display a URL
- Giving a Frame the Input Focus
- Accessing Java from JavaScript.
- Calling Java Methods Directly
- Using Applets to Perform Operations for JavaScript
- Controlling Applets from JavaScript
- Accessing JavaScript from Java.
- Using the "javascript:" URL
- Using JSObject
- Summary.
- The Array Object.
- The Button Object.
- The Checkbox Object.
- The Date Object.
- The Document Object.
- The Element Object.
- The FileUpload Object.
- The Form Object.
- The Function Object.
- The Hidden Object.
- The History Object.
- The Image Object.
- The JavaObject Object.
- The JavaPackage Object.
- The Layer Object.
- The Link Object.
- The Location Object.
- The Math Object.
- The MimeType Object.
- The Navigator Object.
- The Number Object.
- The Object Object.
- The Option Object.
- The Password Object.
- The Plugin Object.
- The Radio Object.
- The RegExp Object.
- The Reset Object.
- The Screen Object.
- The Select Object.
- The String Object.
- The Submit Object.
- The Text Object.
- The Textarea Object.
- The Window Object.
- Summary.