[Next] [Index]

Writing Server-Side JavaScript Applications

This book provides information about JavaScript's server-side capabilities, what has been added to core JavaScript to run on the server, and how the language differs between the client and the server. It also provides extra information you need to create a server-side JavaScript application.

Release version: 12/18/97.

Contents

Getting Started

What You Should Already Know
Where to Find JavaScript Information
What's New in this Release
Upgrading from an Earlier Release
Backward Compatibility with Earlier Releases
Document Conventions
About Sample Code

Part 1 Basics of JavaScript Application Development

Chapter 1  Introduction

This chapter introduces server-side JavaScript and explains how it fits into the entire JavaScript language. It details what hardware and software you must have to use server-side JavaScript and how you must configure your web server to use server-side JavaScript.
The JavaScript Language
Client-Side JavaScript
Server-Side JavaScript
Architecture of JavaScript Applications
System Requirements
Configuration Information
Enabling Server-Side JavaScript
Protecting the Application Manager
Setting Up for LiveConnect
Locating the Compiler

Chapter 2  Introduction to the Sample Applications

This chapter describes the sample server-side JavaScript applications that ship with Netscape web servers. It introduces using server-side JavaScript by working with two of the simpler 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 3  Mechanics of Developing JavaScript Applications

This chapter describes the process of developing your application, such as how to use the JavaScript application compiler and how to use the Application Manager of Netscape servers to install or debug your application. For information on using only client-side JavaScript, see the JavaScript Guide.
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 Server-Side JavaScript Features

Chapter 4  Basics of Server-Side JavaScript

This chapter describes the basics of server-side JavaScript. It introduces server-side functionality and the differences between client-side and server-side JavaScript. The chapter describes how to embed server-side JavaScript in HTML files. It discusses what happens at runtime on the client and on the server, so that you can understand what to do when. The chapter describes how you use JavaScript to change the HTML page sent to the client and, finally, how to share information between the client and server processes.
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 5  Session Management Service

This chapter describes the Session Management Service objects available in server-side JavaScript for sharing data among multiple client requests to an application, among multiple users of a single application, or even among multiple applications on a server.
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 6  Working with Java and CORBA Objects Through LiveConnect

This chapter describes using LiveConnect to connect your server-side JavaScript application to Java components or classes on the server. Through Java you can connect to CORBA-compliant distributed objects using Netscape Internet Service Broker for Java.
Predefined Java Classes
Data Type Conversion
Calling Java from JavaScript
Referring to a Java Object in JavaScript
Example of JavaScript Calling Java
Calling JavaScript from Java
Referring to a JavaScript Object in Java
Threading
Example of Java Calling JavaScript
Accessing CORBA Services
Flexi Sample Application
Deployment Alternatives

Chapter 7  Other JavaScript Functionality

This chapter describes additional server-side JavaScript functionality you can use to send email messages from you application, access the server file system, include external libraries in your application, or directly manipulate client requests and client responses.
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 3 LiveWire Database Service

Chapter 8  Connecting to a Database

This chapter discusses how to use the LiveWire Database Service to connect your application to DB2, Informix, ODBC, Oracle, or Sybase relational databases. It describes how to choose the best connection methodology for your application.
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 9  Working with a Database

This chapter discusses working with DB2, Informix, ODBC, Oracle, or Sybase relational databases. It describes how to retrieve information from the database and use it in your application, how to work with database transactions, and how to execute database stored procedures.
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 10  Configuring Your Database

This chapter describes how to set up your database to run with the LiveWire Database Service. You should read this chapter and "Configuration Information" before you try to use LiveWire with your JavaScript applications.
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 11  Data Type Conversion

This chapter describes how the JavaScript runtime engine on the server converts between the more complex data types used in relational databases and the simpler ones defined for JavaScript.
Working with Dates and Databases
Data-Type Conversion by Database

Chapter 12  Error Handling for LiveWire

This chapter describes the types of errors you can encounter when working with relational databases.
Return Values
Number
Object
Boolean
String
Void
Error Methods
Status Codes

Chapter 13  Videoapp and Oldvideo Sample Applications

This chapter describes the videoapp sample application, which illustrates the use of the LiveWire Database Service. It describes how to configure your environment to run the 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

Index


[Next] [Index]

Last Updated: 12/18/97 12:45:30


Copyright © 1997 Netscape Communications Corporation