Figure 2.1 Architecture of the client-server JavaScript application environment
videoapp
application) and any applications you create.
Figure 2.2 Server-side JavaScript in the Netscape server environment
SCRIPT
tag and server-side JavaScript by the SERVER
tag.
You can also write files that contain only JavaScript statements and no HTML tags. A JavaScript file can contain either client-side JavaScript or server-side JavaScript; a single file cannot contain both client-side and server-side objects or functions.
If the HTML and JavaScript files contain server-side JavaScript, you then compile them into a single JavaScript application executable file. The executable is called a web file and has the extension .web
. The JavaScript application compiler turns the source code HTML into platform-independent bytecodes, parsing and compiling server-side JavaScript statements.
Finally, you deploy your application on your web server and use the JavaScript Application Manager to install and start the application, so that users can access your application.
At runtime, when a client requests a page from a server-side JavaScript application, the runtime engine locates the representation of that file in the application's web file. It runs all the server code found and creates an HTML page to send to the client. That page can contain both regular HTML tags and client-side JavaScript statements. All server code is run on the server, before the page goes to the client and before any of the HTML or client-side JavaScript is executed. Consequently, your server-side code cannot use any client-side objects, nor can your client-side code use any server-side objects.
For more details, see Chapter 12, "Basics of Server-Side JavaScript."
NOTE: If you do not enable the JavaScript runtime engine, JavaScript applications cannot run on the server.Once you activate the JavaScript application environment, you must stop and restart your web server for the associated environment variables to take effect. If you do not, JavaScript applications that use the LiveWire Database Service will not run.
dbadmin
sample application. For more information, see the administrator's guide for your web server.
If your server is not using the Secure Sockets Layer (SSL), the user name and password for the Application Manager are transmitted unencrypted over the network. An intruder who intercepts this data can get access to the Application Manager. If you use the same password for your administration server, the intruder will also have control of your server. Therefore, it is recommended that you do not use the Application Manager outside your firewall unless you use SSL. For instructions on how to turn on SSL for your server, see the administrator's guide for your web server.
$NSHOME\js\samples
directory, where $NSHOME
is the directory in which you installed the server. The installation procedure also modifies the web server's CLASSPATH
environment variable to automatically include this directory.
You must either install your Java classes in this same directory or modify the CLASSPATH
environment variable of the server to include the location of your Java classes. In addition, the CLASSPATH
environment variable of the process in which you compile the Java classes associated with your JavaScript application must also include the location of your Java classes.
Remember, if you use the Admin Server to start your web server, you'll have to set CLASSPATH
before you start the Admin Server. Alternatively, you can directly modify the obj.conf
file for your web server. For information on this file, see your web server's administrator's guide.
On NT, if you modify CLASSPATH
and you start the server using the Services panel of the control panel, you must reboot your machine after you set CLASSPATH
in the System panel of the control panel.
PATH
environment variable to include the directory in which the JavaScript application compiler is installed. If you want to be able to easily refer to the location of the compiler, you must modify this environment variable.
On Unix systems, you have various choices on how to change your PATH
environment variable. You can add $NSHOME/bin/https
, where $NSHOME
is the directory in which you installed the server. See your system administrator for information on how to do so.
To change your NT system path, start the Control Panel application, locate the System dialog box, and set the PATH
variable in the Environment settings to include the %NSHOME%\bin\https
, where NSHOME
is the directory in which you installed the server.
If you move the JavaScript application compiler to a different directory, you must add that directory to your PATH
environment variable.
Last Updated: 11/12/98 15:29:09
Any sample code included above is provided for your use on an "AS IS" basis, under the Netscape License Agreement - Terms of Use