Web
Crossing Server-side JavaScript
Introduction
WCJS and WCTL
Resources
Next Section
Introduction
Web Crossing
4.0 contains a powerful, major new technology in addition Web
Crossing's plethora of features - a complete implementation of
server-side JavaScript. Web Crossing JavaScript (WCJS)
is thoroughly integrated with Web Crossing's database and conferencing
system.
The implications
of this new technology cannot be underestimated.
Web page
designers who are somewhat familiar with JavaScript often have
a preconceived notion about the limits of the language, based
on their experience with what can be practically accomplished
with JavaScript when embedded inside the HTML of a web page. That
kind of JavaScript, called client-side JavaScript (because
the JavaScript is executed by the client browser) does have a
great many limitations. In addition, experienced web designers
are often frustrated by a wide degree of incompatibility in different
client-side JavaScript implementations among different browsers.
Often even a simple JavaScript program that runs on Netscape Navigator
will not run correctly on Microsoft Internet Explorer, or vice-versa.
However,
the fact of the matter is JavaScript is an extremely rich, powerful
and flexible language in its own right. It has a large, highly
developed syntax, a huge library of standard methods (functions)
and the built-in capability to create complex, object-oriented
data structures and methods.
Web Crossing's
version of JavaScript (WCJS) runs on the server-side, executed
by Web Crossing itself, and has huge advantages over client-side
JavaScript. Among these advantages are:
- There
is no JavaScript compatibility problem between different browsers.
In fact, the user's browser need not support JavaScript at all.
The JavaScript is completely invisible to the browser and user.
Web Crossing processes everything on the server side and just
sends standard HTML to the user for viewing.
- Server-side
JavaScript is much faster than client-side JavaScript. The speed
is at least 15 times as fast, and is improving all the time
with improved compilers.
- Most
importantly, WCJS is thoroughly integrated with Web Crossing
itself. You can use WCJS to create users, folders, discussions,
messages and other Web Crossing objects. You can create new
objects and properties and store them in the Web Crossing database.
You can freely extend the kinds of objects handled by
Web Crossing. You can create new methods and commands
for Web Crossing. In other words, you can use Web Crossing as
a full-fledged platform for unlimited kinds of Internet application
development, including XML-RPC (remote
procedure calls).
Web
Crossing JavaScript and WCTL
And what
of Web Crossing Template Language
(WCTL)? How does WCJS fit in with WCTL?
WCTL
is a highly optimized proprietary scripting language developed
specifically for Web Crossing. The entire user interface is described
in templates (special macros) written in WCTL. There are many
samples of these templates in the standard.tpl file (found
in your webx directory) which you can customize. Customizing
these templates allow you to change the appearance and operations
of your Web Crossing server.
However
there are limits to what WCTL is able to do as a programming language.
For example, WCTL has no support for arrays, or other complex
data types. WCTL does not support user-defined functions with
parameter passing. WCTL does not support the creation of complicated
new objects (though it does support the creation of new properties
for existing objects). WCTL does not have the familiar, strong
programming structures such as for loops and switch
structures found in other languages. WCTL does not have floating
point mathematical functions. WCTL does not allow the creation
of object-oriented methods with prototyping. WCTL does not have
support for Perl-like regular expressions. All these, and much
more, are part of Web Crossing Server-side JavaScript.
In addition,
JavaScript is a widely used programming language with many reference
materials and libraries of programs already available for you
to use as a base for starting your programming.
On the
other hand, there are some things that still can be done only
in WCTL. For example, non-macro bits and pieces of WCTL (scripts
with no names) can be embedded directly inside folder and discussion
headers. This can not be done with JavaScript directly at the
present time. Also, there are still several WCTL built-in commands
and variables for which there are no JavaScript equivalents yet.
However, as you will see, you can always call WCTL expressions
from inside Web Crossing JavaScript.
The bottom
line, with regards to Web Crossing, is this - all future Web Crossing
development will concentrate on server-side JavaScript. WCTL will
be supported indefinitely for backwards compatibility, but the
Web Crossing development language of choice is JavaScript from
now on.
If you
are not experienced with JavaScript you are strongly encouraged
to pick up a book on the subject and
try your hand with some programming. If you are already experienced
with C, C++ or Java programming, you will find your transition
to JavaScript programming very easy, because much of the same
syntax is shared by all four languages.
That
said, before proceeding with some examples of how to use WCJS,
you should first understand JavaScript programming. This documentation
assumes you already have some experience programming in JavaScript
and will concentrate on how to use JavaScript within the context
of Web Crossing, rather than explaining how to program in JavaScript.
Enhanced features that are specific to Web Crossing JavaScript
are also introduced.
Next Section
The next
section will show you how to create and execute a JavaScript
function from inside Web Crossing.
Resources
Recommended
book:
-
JavaScript - The Definitive Guide, 3rd Edition,
David Flanagan, O'Reilly
This book really is the definitive guide. It
is thorough, readable and answers all your questions about JavaScript.
It is an indispensable resource for any serious JavaScript programmer.
In fact, I won't even recommend any other books. Just get this
one!
Web
Crossing Tech Support Forum
Developer
Center
|