security URLmerchant systemChat community system server navigator TCP/IP HTML Publishing

PersonalServer-Side JavaScript Guide Inter ww Version 1.2 Proxy SSL Mozilla IStore Publishing Internet secure sockets layer mail encryption HTMLhttp://www comp.syselectronic commerce JavaScript directory server news certificate Proxy Communications Corporation ("Netscape") and its licensors retain all ownership rights to the programs offered by Netscape (referred to herein as "Software") and related documentation. Use of the Software and related documentation is governed by the license agreement accompanying the Software and applicable copyright law. Your right to copy this documentation is limited by copyright law. Making unauthorized copies, adaptations, or compilation works is prohibited and constitutes a punishable violation of the law. Netscape may revise this documentation from time to time without notice. THIS DOCUMENTATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN NO EVENT SHALL NETSCAPE BE LIABLE FOR INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY KIND ARISING FROM ANY ERROR IN THIS DOCUMENTATION, INCLUDING WITHOUT LIMITATION ANY LOSS OR INTERRUPTION OF BUSINESS, PROFITS, USE, OR DATA. The Software and documentation are copyright ©1994-1998 Netscape Communications Corporation. All rights reserved. Netscape, Netscape Navigator, Netscape Certificate Server, Netscape DevEdge, Netscape FastTrack Server, Netscape ONE, SuiteSpot and the Netscape N and Ship’s Wheel logos are registered trademarks of Netscape Communications Corporation in the United States and other countries. Other Netscape logos, product names, and service names are also trademarks of Netscape Communications Corporation, which may be registered in other countries. JavaScript is a trademark of Sun Microsystems, Inc. used under license for technology invented and implemented by Netscape Communications Corporation. Other product and brand names are trademarks of their respective owners. The downloading, exporting, or reexporting of Netscape software or any underlying information or technology must be in full compliance with all United States and other applicable laws and regulations. Any provision of Netscape software or documentation to the U.S. Government is with restricted rights as described in the license agreement accompanying Netscape software.

.

Recycled and Recyclable Paper

Version 1.2 ©1998 Netscape Communications Corporation. All Rights Reserved Printed in the United States of America. 00 99 98 5 4 3 2 1

Netscape Communications Corporation, 501 East Middlefield Road, Mountain View, CA 94043 New Features in this Release

This section contains the following topics: • Changes to Server-Side JavaScript • Changes to Core JavaScript 1.2 • Upgrading from an Earlier Release • Backward Compatibility with Earlier Releases

Changes to Server-Side JavaScript

With the release of the 3.x versions of Netscape web servers, Netscape LiveWire 1.01 is fully integrated into the web servers. Since LiveWire database connectivity is now integrated as the LiveWire Database Service portion of server-side JavaScript, developers do not have to install LiveWire as a separate product. Simply turn on the JavaScript support in the Administration Server to make the necessary components available.

The following improvements have been made to server-side JavaScript:

• Support for core JavaScript 1.2. See “Changes to Core JavaScript 1.2” on page 5.

• New Lock class. The Lock class allows safe sharing of information with multiple incoming requests. See “Sharing Objects Safely with Locking” on page 279.

• New SendMail class. The SendMail class lets you generate email from JavaScript. See “Mail Service” on page 287.

• Property value types. Property values can be of any data type, rather than just strings, for the project, server, and request objects. In particular, you can now use project and server objects to store references to other objects. See “The project Object” on page 260, “The server Object” on page 261, and “The request Object” on page 249.

3 Changes to Server-Side JavaScript

• Direct access to HTTP request and response headers. See “Request and Response Manipulation” on page 302.

• Access Java classes. You can access Java classes using LiveConnect. See Chapter 21, “LiveConnect Overview.”

• IIOP. You can access legacy applications using IIOP. See Chapter 22, “Accessing CORBA Services.”

• Multiple simultaneous connections. LiveWire has support for multiple simultaneous connections to multiple databases. See Chapter 15, “Connecting to a Database.”

• Span multiple client requests. LiveWire database connections and transactions (and the objects used with them) can span multiple client requests instead of having to be restarted for each request. See “Individual Database Connections” on page 323 and “Managing Transactions” on page 348.

• Stored procedures. LiveWire has support for stored procedures. See “Calling Stored Procedures” on page 354.

• ODBC support. LiveWire has ODBC support under Unix. See “Supported Database Clients and ODBC Drivers” on page 372.

• Multithreading. LiveWire supports multithreading of Informix, Oracle, and Sybase database client libraries for improved performance and scalability. See “Supported Database Clients and ODBC Drivers” on page 372. This support is available only if the underlying platform supports multithreading. For information on which platforms support it, see Enterprise Server 3.x Release Notes

4 Server-Side JavaScript Guide Changes to Core JavaScript 1.2

Changes to Core JavaScript 1.2

JavaScript version 1.2 provides the following new features and enhancements:

• Create objects with initializers. You can create objects using object initializers. See “Object Literals” on page 83 and “Creating New Objects” on page 141.

• Changes to arrays. Array objects can be created using literal notation. See “Creating an Array” on page 148.

• Regular expressions. Regular expressions are patterns used to match character combinations in strings. You create a regular expression as an object that has methods used to execute a match against a string. You can also pass the regular expression as an argument to the String methods match, replace, search, and split. The RegExp object has properties most of which are set when a match is successful, such as lastMatch which specifies the last successful match. The Array object has new properties that provide information about a successful match such as input which specifies the original input string against which the match was executed. See Chapter 6, “Regular Expressions” for information.

• New top-level functions Number and String. The Number function converts an object to a number. The String function converts an object to a string. See “Number and String Functions” on page 137.

• Changes to eval. eval is no longer a method of individual objects; it is available only as a top-level function. See “eval Function” on page 135.

• New and changed operators.

• The new delete operator deletes an object, an object’s property, or an element at a specified index in an array. See “delete” on page 98.

•If the