Thursday, September 15, 2005

The Return of Server Side JavaScript (SSJS)

Remember Server Side JavaScript (SSJS)? (okay you are probably far too young) It came out of a time when the most popular browser was NCSA Mosaic, some people were still trying to use C libraries to create CGI scripts and when Java was in early beta. SSJS has not been widely integrated in application servers. With the recent trend in AJAX applications it looks like SSJS might be on the brink of a renaissance.

In the AJAX sphere there has been much interest in Direct Web Remoting (DWR) which allows JavaScript access to Java beans methods via servlet generated JavaScript files. But why stop there, why not have JavaScript talking to JavaScript? (there is a certain perverse logic in there somewhere). It turns out that there are already several like minded offerings where JavaScript has become the Server Side scripting language of choice.

Mozilla produced Rhino, a Java based JavaScript engine as part of the Xena project. Several server side application platforms have been produced based upon Rhino. You can use Rhino directly, see these interesting articles on using Rhino with web services (1, 2) and it also supports E4X. I must also mention Seppia which is an application that embeds Rhino that might also be interesting to look at. Now to the Server Side JavaScript applications, here are a few examples that caught my eye:

  • Rhinola (based on Rhino, well duh!) and seemingly Unix server oriented uses mod_gcj to run JavaScript files as server side scripts much in the manner that you would expect Perl or PHP scripts to run.
  • JSDB is a versatile JavaScript scripting toolkit environment with support for database access.
  • Whitebeam is an application server with the Rhino engine at its core. As you would expect from an application server it integrates support for accessing databases and with Rhino's built-in support for E4X is also a dab hand at anything XML based (such as web services).
  • OpenMocha is an application server based on Helma which uses the Rhino JavaScript engine to do server side scripting. To my eye this looked like a distinctly content management system (CMS) based application.

In conclusion, it looks like JavaScript is rearing it's head in more places than in client side browsers. We're seeing JavaScript in desktop applications and on the server side once more. With E4X it has actually become easier to use JavaScript for XML manipulation than it is in many other so called real programming languages. From where I am sitting it looks like the future of JavaScript will be a bright one.

6 comments:

Mark McLaren said...

Also Apache Cocoon gives the option of implementing server-side logic in Javascript. See: http://cocoon.apache.org/2.1/userdocs/flow/index.html
Note: Comment imported. Original by Ugo Cei website: http://agylen.com/ at 2005-09-15 13:12

Mark McLaren said...

Hi, maybe you can take a look at firecat, a Server-Side JavaScript Webserver:

http://firecat.nihonsoft.org
Note: Comment imported. Original by David Fu website: http://blog.netbeans.jp/roller/page/fchoong at 2006-01-24 10:23

Mark McLaren said...

wxJS has an Apache module which can be used to write server side JavaScript applications: http:://wxjs.sourceforge.net
Note: Comment imported. Original by Franky Braem website: http://wxjs.sourceforge.net at 2006-05-18 15:25

Mark McLaren said...

Just to point out, Whitebeam uses the SpiderMonkey JavaScript implementation - the same one that the Firefox browser users. The latest Whitebeam release includes the E4X implementation from SpiderMonkey.


Note: Comment imported. Original by Peter Wilson website: http://www.whitebeam.org at 2007-03-05 00:34

Mark McLaren said...

JavaScript was developed by God or by an Alien intelligence.



I found this article by searching an implementation of JavaScript ServerSide on google, cause, as you said, using Ajax is natural to have javascript also on the server. It would be wonderful.. if I think about JSON object and databases, i'm bored to read book about how to translate tables in java object and than translate this in JSON strings or in XML for client side elaboration, JSON is the reply, yeah!!
Note: Comment imported. Original by Luigi Tascapani at 2007-09-05 14:56

Mark McLaren said...

I agree with you Luigi. I would advise you to take a look at POW and Google Gears also. As the recent trend is for running JavaScript Servers on the client side!
Note: Comment imported. Original by markmc website: http://content.mark-mclaren.info/ at 2007-09-05 17:23