From the Director of Evangelism for Aptana

Kevin Hakman

Subscribe to Kevin Hakman: eMailAlertsEmail Alerts
Get Kevin Hakman: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: RIA Developer's Journal, Java Developer Magazine, PHP Developer's Journal

RIA & Ajax: Article

JavaScript Powers Up the Server Side

Be the envy of your Java, .NET, PHP, Perl, Python, and Ruby peers

Aptana Jaxer is a new open source application server built especially for AJAX application development in JavaScript. To say that "Jaxer lets you do JavaScript on the server-side" would be accurate, but an understatement. The core concept of Jaxer is that it provides a parity of environments at the client and the server to simplify the creation of rich AJAX pages, apps, and gadgets - and by so doing, gives the Web developer a unified runtime at both the client and server tiers.

How does Jaxer achieve this parity of environments? The main engine in Jaxer is the Mozilla engine - the same Mozilla engine you find in the Firefox Web browser. This means that besides JavaScript on the server, you also have the full spectrum of AJAX technologies available to you including DOM manipulations, CSS, and XHR plus other goodies that Mozilla implements like native XML support for JavaScript (E4X).

All of Jaxer's APIs are implemented in JavaScript and accessed via the Jaxer object. Using Jaxer, JavaScript developers can do all kinds of server-side coding that would have been the envy of their Java, .NET, PHP, Perl, Python, or Ruby peers. Jaxer.Session, for example, can create and manage user sessions; Jaxer.DB facilitates SQL database access; Jaxer.File lets you read/write files, and Jaxer.web lets you communicate across network sockets.

However, some of the most unique capabilities of Jaxer include the server-side manipulation of the HTML DOM and the ability to use AJAX libraries of your choice on the server side as well. Let's take a look at a simple example that puts these principles to work - in this case a simple survey application.

Building a Simple Voting Application
Let's vote...

In this example, we're going to build a simple voting tool using a single page of DHTML. The implementation is quite basic but covers a few good examples of how to use many of Aptana Jaxer's capabilities including:

  • Executing JavaScript on the server
  • Using AJAX libraries on the sever (jQuery in this example)
  • Creating and accessing a database
  • Server-side DOM manipulation
  • Storing and retrieving session data
  • E4X (native XML support for ECMAScript) as a templating mechanism
  • Handling form data

More Stories By Kevin Hakman

Kevin Hakman is Director of Evangelism for Aptana, Inc., makers of the popular Aptana Studio web development suite. As early as 2001 Kevin was pioneering AJAX web applications via General Interface, a full AJAX development and GUI toolkit which he co-founded, and later sold to TIBCO Software in 2004. Kevin is a contributor to AJAXWorld Magazine, and has spoken at numerous AJAX industry events.

More Stories By Davey Waterson

Davey Waterson is a JavaScript architect at Aptana. He started out with Cobol coded on punch cards running on a Burroughs B1700 through to a DHTML Web UI using xhtmlRequest and Async Java. Davey has more than 20 years or experience as a code junky technophile and has worked in the industry in both Europe and North America.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.