Next | Index

Server-Side JavaScript Guide

This book explains how to use core and server-side JavaScript for version 1.2. JavaScript is Netscape's cross-platform, object-based scripting language for client and server applications.

Contents

New Features in this Release

Changes to Server-Side JavaScript
Changes to Core JavaScript 1.2
Upgrading from an Earlier Release
Backward Compatibility with Earlier Releases

About this Book

New Features in this Release
What You Should Already Know
JavaScript Versions
Where to Find JavaScript Information
Document Conventions

Chapter 1  JavaScript Overview

What Is JavaScript?
Core, Client-Side, and Server-Side JavaScript
Core JavaScript
Client-Side JavaScript
Server-Side JavaScript
JavaScript and Java
Debugging JavaScript
Visual JavaScript
JavaScript and the ECMA Specification
Relationship Between JavaScript and ECMA Versions
JavaScript Documentation vs. the ECMA Specification
JavaScript and ECMA Terminology

Part 1 Developing Server Applications

Chapter 2  Getting Started

Architecture of JavaScript Applications
System Requirements
Configuration Information
Enabling Server-Side JavaScript
Protecting the Application Manager
Setting Up for LiveConnect
Locating the Compiler

Chapter 3  How to Develop Server Applications

Basic Steps in Building an Application
JavaScript Application Manager Overview
Creating Application Source Files
Compiling an Application
Installing a New Application
Application URLs
Controlling Access to an Application
Modifying Installation Fields
Removing an Application
Starting, Stopping, and Restarting an Application
Running an Application
Debugging an Application
Using the Application Manager
Using Debug URLs
Using the debug Function
Deploying an Application
Application Manager Details
Configuring Default Settings
Under the Hood

Part 2 Core Language Features

Chapter 4  Values, Variables, and Literals

Values
Data Type Conversion
Variables
Declaring Variables
Evaluating Variables
Variable Scope
Literals
Array Literals
Boolean Literals
Floating-Point Literals
Integers
Object Literals
String Literals

Chapter 5  Expressions and Operators

Expressions
Operators
Assignment Operators
Comparison Operators
Arithmetic Operators
Bitwise Operators
Logical Operators
String Operators
Special Operators
Operator Precedence

Chapter 6  Regular Expressions

Creating a Regular Expression
Writing a Regular Expression Pattern
Using Simple Patterns
Using Special Characters
Using Parentheses
Working with Regular Expressions
Using Parenthesized Substring Matches
Executing a Global Search and Ignoring Case
Examples
Changing the Order in an Input String
Using Special Characters to Verify Input

Chapter 7  Statements

Conditional Statements
if...else Statement
switch Statement
Loop Statements
for Statement
do...while Statement
while Statement
label Statement
break Statement
continue Statement
Object Manipulation Statements
for...in Statement
with Statement
Comments

Chapter 8  Functions

Defining Functions
Calling Functions
Using the arguments Array
Predefined Functions
eval Function
isFinite Function
isNaN Function
parseInt and parseFloat Functions
Number and String Functions
escape and unescape Functions

Chapter 9  Working with Objects

Objects and Properties
Creating New Objects
Using Object Initializers
Using a Constructor Function
Indexing Object Properties
Defining Properties for an Object Type
Defining Methods
Using this for Object References
Deleting Objects
Predefined Core Objects
Array Object
Boolean Object
Date Object
Function Object
Math Object
Number Object
RegExp Object
String Object

Chapter 10  Details of the Object Model

Class-Based vs. Prototype-Based Languages
Defining a Class
Subclasses and Inheritance
Adding and Removing Properties
Summary of Differences
The Employee Example
Creating the Hierarchy
Object Properties
Inheriting Properties
Adding Properties
More Flexible Constructors
Property Inheritance Revisited
Local versus Inherited Values
Determining Instance Relationships
Global Information in Constructors
No Multiple Inheritance

Part 3 Server-Side JavaScript Features

Chapter 11  Quick Start with the Sample Applications

Hello World
What Hello World Does
Looking at the Source Script
Modifying Hello World
Hangman
Looking at the Source Files
Debugging Hangman

Chapter 12  Basics of Server-Side JavaScript

What to Do Where
Overview of Runtime Processing
Server-Side Language Overview
Core Language
Usage
Environment
Classes and Objects
Embedding JavaScript in HTML
The SERVER tag
Backquotes
When to Use Each Technique
Runtime Processing on the Server
Constructing the HTML Page
Generating HTML
Flushing the Output Buffer
Changing to a New Client Request
Accessing CGI Variables
Communicating Between Server and Client
Sending Values from Client to Server
Sending Values from Server to Client
Using Cookies
Garbage Collection

Chapter 13  Session Management Service

Overview of the Predefined Objects
The request Object
Properties
Working with Image Maps
The client Object
Properties
Uniquely Referring to the client Object
Creating a Custom client Object
The project Object
Properties
Sharing the project Object
The server Object
Properties
Sharing the server Object
Techniques for Maintaining the client Object
Comparing Client-Maintenance Techniques
Client-Side Techniques
Server-Side Techniques
The Lifetime of the client Object
Manually Appending client Properties to URLs
Sharing Objects Safely with Locking
Using Instances of Lock
Special Locks for project and server Objects
Avoiding Deadlock

Chapter 14  Other JavaScript Functionality

Mail Service
File System Service
Security Considerations
Creating a File Object
Opening and Closing a File
Locking Files
Working with Files
Example
Working with External Libraries
Guidelines for Writing Native Functions
Identifying Library Files
Registering Native Functions
Using Native Functions in JavaScript
Request and Response Manipulation
Request Header
Request Body
Response Header

Part 4 LiveWire Database Service

Chapter 15  Connecting to a Database

Interactions with Databases
Approaches to Connecting
Database Connection Pools
Single-Threaded and Multithreaded Databases
Managing Connection Pools
Sharing a Fixed Set of Connection Pools
Sharing an Array of Connection Pools
Individual Database Connections
Maintaining a Connection Across Requests
Waiting for a Connection
Retrieving an Idle Connection

Chapter 16  Working with a Database

Automatically Displaying Query Results
Executing Arbitrary SQL Statements
Manipulating Query Results with Cursors
Creating a Cursor
Displaying Record Values
Displaying Expressions and Aggregate Functions
Navigating with Cursors
Working with Columns
Changing Database Information
Managing Transactions
Using the Transaction-Control Methods
Working with Binary Data
Calling Stored Procedures
Exchanging Information
Steps for Using Stored Procedures
Registering the Stored Procedure
Defining a Prototype for a Stored Procedure
Executing the Stored Procedure
Working with Result Sets
Working with Return Values
Working with Output Parameters
Informix and Sybase Exceptions

Chapter 17  Configuring Your Database

Checking Your Database Configuration
Supported Database Clients and ODBC Drivers
DB2
DB2 Remote
DB2 Local
Informix
Informix Remote
Informix Local
ODBC
ODBC Data Source Names (NT only)
OpenLink ODBC Driver (Solaris only)
Visigenic ODBC Driver (Unix only)
Oracle
Oracle Remote
Oracle Local
Sybase
Sybase Remote
Sybase Local
Sybase (Unix only)

Chapter 18  Data Type Conversion

Working with Dates and Databases
Data-Type Conversion by Database

Chapter 19  Error Handling for LiveWire

Return Values
Number
Object
Boolean
String
Void
Error Methods
Status Codes

Chapter 20  Videoapp and Oldvideo Sample Applications

Configuring Your Environment
Connecting to the Database and Recompiling
Creating the Database
Running Videoapp
Looking at the Source Files
Application Architecture
Modifying videoapp

Part 5 Working with LiveConnect

Chapter 21  LiveConnect Overview

What Is LiveConnect?
Working with Wrappers
JavaScript to Java Communication
The Packages Object
Working with Java Arrays
Package and Class References
Arguments of Type char
Example of JavaScript Calling Java
Java to JavaScript Communication
Using the LiveConnect Classes
Accessing Server-Side JavaScript
Data Type Conversions
JavaScript to Java Conversions
Java to JavaScript Conversions

Chapter 22  Accessing CORBA Services

About CORBA Services
Flexi Sample Application
CORBA Client and Server Processes
Starting FlexiServer
Starting Flexi
Using Flexi
Looking at the Source Files
Deployment Alternatives

Glossary

Index


Next | Index

Last Updated: 11/12/98 15:29:01

Copyright (c) 1998 Netscape Communications Corporation