NOTE: The difference between SSJS in Netscape Enterprise Server (NES) 3.x and NES 4.x is that NES 4.x now uses a JavaScript Runtime from Mozilla.org which supports JavaScript 1.4. Previous versions of SSJS supported JavaScript 1.0, JavaScript 1.1, and JavaScript 1.2.Support for JavaScript 1.4
JavaScript version 1.4 provides several new features and enhancements, which are discussed in the online manual Core JavaScript Reference v1.4 at:http://developer.netscape.com/docs/manuals/js/core/jsref/index.htmThe following list summarizes the new features:
- Exception handling.
You can throw and catch exceptions using thethrow
andtry...catch
statements.- New operators
Thein
andinstanceof
.in
operator returnstrue
if the specified property is in the specified object. Theinstanceof
operator returnstrue
if the specified object is of the specified object type.- Changes to LiveConnect.
Several changes to LiveConnect improve the way Java and JavaScript code communicate:
- The methods of
java.lang.Object
are inherited byJavaArray
. In addition, theJavaArrary.toString
method now calls the methodjava.lang.Object.toString
.- You can pass a
JavaClass
object to a Java method which requires an argument of typejava.lang.Class
instead of creating a wrapper around an instance ofjava.lang.Class
.- You cannot construct an instance of
JSException
with a detail message.- The three original public constructors for the Java class
netscape.javascript.JSException
that supported this feature are deprecated.- You cannot use the
==
operator to compare two instances ofJSObject
. UseJSObject.equals
.- Changes to the
eval
method.
- The top-level
eval
method cannot be called indirectly. In previous versions, it was recommended that this method not be called indirectly; starting with JavaScript 1.4, callingeval
indirectly could result in a runtime error. This change improves performance.- The
eval
method is no longer available as a method ofObject
; use the top-leveleval
function instead.- Changes to the Function object.
Changes to the JavaScript Application Manager
The functionality of the JavaScript Application Manager has not changed in Enterprise Server 4.0 compared to Enterprise Server 3.x. However, it uses the the same new color scheme as the Server Manager in Enteprise Server 4.0 and it has some minor layout rearrangements. Figure 0.1 shows the JavaScript Application Manager in Enteprise Server 4.0.Figure 0.1 The JavaScript Application Manager in Enterprise Server 4.0
The JavaScript Application Manager now has three tabs:Although the names and layout of the tabs and buttons are slightly different in the JavaScript Application Manager in Enterprise Server 4.0 than in Enterprise Server 3.6, the underlying functionality is unchanged.
- Applications
Lists the installed applications and displays buttons for Start, Stop, Restart, Run, Debug, Modify and Remove on the left. The right panel displays information about the application selected in the applications list. If you click Modify, the right panel displays fields that let you modify the selected application.- Add Application.
Lets you add a new application.- Preferences.
Lets you specify the default values when adding a new application.What You Should Already Know
This book assumes you have this basic background:
- A general understanding of the Internet and the World Wide Web (WWW).
- A general understanding of client-side JavaScript. This book does not duplicate core or client-side language information.
- Good working knowledge of Hypertext Markup Language (HTML). Experience with forms and the Common Gateway Interface (CGI) is also useful.
- Some programming experience in Pascal, C, Perl, Visual Basic, or a similar language.
- If you're going to use the LiveWire Database Service, familiarity with relational databases and a working knowledge of Structured Query Language (SQL).
JavaScript Versions
Each version of the Netscape Enterprise Server supports a different version of JavaScript. To help you write scripts that are compatible with multiple versions of the Enterprise Server, this manual uses an abbreviation to indicate the server version in which each feature was implemented.JavaScript and Netscape Enterprise Server versions
JavaScript Version Enterprise Server version
Where to Find JavaScript Information
Because JavaScript can be approached on several levels, its documentation has been split across several books to facilitate your introduction. The suite of online JavaScript books includes: The server-side JavaScript documentation includes the following books:If you are new to JavaScript, start with Chapter 1, "JavaScript Overview," then continue with the rest of the book. Once you have a firm grasp of the fundamentals, you can use the Server-Side JavaScript Reference to get more details on individual objects and statements. Use the material in this book to familiarize yourself with core and server-side JavaScript. Use the Client-Side JavaScript Guide and Client-Side JavaScript Reference for information on scripting HTML pages. Enterprise Server 4.x Release Notes provides late-breaking information on Enterprise Server 4.x, including some information relevant to server-side JavaScript for Enterprise Server 4.x. The Netscape Enterprise Server Programmer's Guide summarizes the different programming interfaces available with the 4.x versions of Netscape web servers. Use this guide as a roadmap or starting point for exploring the Enterprise Server documentation for developers. In addition, other Netscape books discuss certain aspects of JavaScript particularly relevant to their topic area. These books are mentioned where relevant throughout this book. The Netscape web site contains much information that can be useful when you're creating JavaScript applications. Some URLs of particular interest include:
- The Server-Side JavaScript Guide (this book) provides information about the JavaScript language and its objects. This book contains information for both core and server-side JavaScript. Some core language features work differently on the client than on the server; these differences are discussed in this book.
- The Server-Side JavaScript Reference provides reference material for the JavaScript language, including both core and server-side JavaScript.
- This is Netscape's technical support page for information on the LiveWire Database Service. It contains lots of useful pointers to information on using LiveWire in your JavaScript applications.
http://help.netscape.com/products/tools/livewire
- This is Netscape's support page for information on server-side JavaScript. For quick access to this URL, click the DevEdge link on the Netscape Enterprise Server Application Manager.
http://developer.netscape.com/one/javascript/ssjs/index.html
- This is View Source Magazine, Netscape's online technical magazine for developers. It is updated every other week and frequently contains articles of interest to JavaScript developers.
http://developer.netscape.com/news/viewsource/index.html
Upgrading from an Earlier Release
If you have previously installed an earlier version of a Netscape web server, you should migrate the server settings when you install the Enterprise Server 4.x. For information on how to install the server and migrate settings, see the Enterprise Server 4.0 Installation and Migration Guide. If you have previously created JavaScript applications using Server-Side JavaScript 3.x, you should be aware of these changes that occur when you upgrade to 4.x and migrate old server settings:
- If the previous server had LiveWire turned on, the 3.x server will have server-side JavaScript turned on. Whether or not the Application Manager requires a password is also preserved. For more information, see "Configuration Information" in Chapter 2, "Getting Started."
- However, upgrading server settings does not move your applications nor does it recompile them for use with the 4.x web server. You must manually recompile user-defined applications before you can use them with a 4.x web server, as described in "Backward Compatibility with Earlier Releases". Be aware that older applications may not work with their original version of the Enterprise Server after recompiling. If you want to use an application with both servers, you should copy the application instead of moving it.
- For information on changes you may have to make in your code when upgrading, see the next section.
Backward Compatibility with Earlier Releases
You must also be aware of these changes in the behavior of server-side JavaScript applications relative to Netscape Enterprise Server 3.x:
- You must recompile all of your existing JavaScript applications. For information on using the compiler, see "Compiling an Application". Once you recompile your applications, they will not work under old SSJS installations.
Document Conventions
JavaScript applications run on many operating systems; the information here applies to all versions. File and directory paths are given in Windows format (with backslashes separating directory names). For Unix versions, the directory paths are the same, except that you use slashes instead of backslashes to separate directories. This book uses uniform resource locators (URLs) of the formhttp://In these URLs, server represents the name of the server on which you run your application, such asserver.domain
/path
/file
.htmlresearch1
orwww
; domain represents your Internet domain name, such asnetscape.com
oruiuc.edu
; path represents the directory structure on the server; andfile
.html
represents an individual filename. In general, items in italics in URLs are placeholders and items in normal monospace font are literals. If your server has Secure Sockets Layer (SSL) enabled, you would usehttps
instead ofhttp
in the URL. This book uses the following font conventions:
The monospace font
is used for sample code and code listings, API and language elements (such as function names and class names), filenames, pathnames, directory names, HTML tags, and any text that must be typed on the screen. (Monospace italic font
is used for placeholders embedded in code.)- Italic type is used for book titles, emphasis, variables and placeholders, and words used in the literal sense.
- Boldface type is used for glossary terms.
Table of Contents | Previous | Next | IndexLast Updated: 09/29/99 18:01:48
© Copyright � 1999 Sun Microsystems, Inc. Some preexisting portions Copyright � 1999 Netscape Communications Corp. All rights reserved.