JavaScript code is one of the most popular languages of Web developers. This language supports the following base objects, plus additional objects from the Document Object Model:
Server-side JavaScript code supports the same base objects, and additional objects that support user access to databases, file systems and e-mail systems. Like client-side JavaScript code, server-side JavaScript code is also platform, browser, and language independent.
You can convert server-side JavaScript applications to the Bean Scripting Framework. This topic describes how to perform this conversion.
Server-side JavaScript source code
Suppose you have the following server-side JavaScript application:
<html> <head> <title>Hello World server-side JavaScript example</title> </head> <body> <br><br> </body> </html> <server> function writePage() write("<center><font size='6'>Hello World</font></center>"); </server>
Convert server-side JavaScript source code to the Bean Scripting Framework (BSF)
Make the following changes to the JavaScript source code to enable BSF:
<%@ page language="javascript" %> <html> <head> <title>Hello World server-side BSF/JavaScript example</title> </head> <body> <br><br> </body> </html> <% out.println("<center><font size='6'>Hello World</font></center>"); %>
Review Bean Scripting Framework and Scenario: Create a Bean Scripting Framework application for deployment information and additional programming examples.