Home  >  

Example of Coding in Jaxer

Author photo
| | Comments (5)
AddThis Social Bookmark Button

So continuing on with my discussion with Jaxer, the new product from Aptana, today I got my hands a bit dirty with the code. I've complained previously about the lack of documentation, so please bear in mind that any code sample I show will probably not be 'best practice' - but since there isn't any best practices doc, I can't be wrong, right? (Of course, by the time I post this, I bet there will be one.)

I took some time to look over the Architecture Review. Jaxer works much like ColdFusion (and other server side languages), where the Jaxer server will preprocess your code before returning it to the browser. Along with removing any server side code, Jaxer will add JavaScript code to your response to help enable it's basic feature sets. Read the review for more details.

How about what Jaxer supports on the server side? The docs say database access is supported (SQLite and MySQL), file access is supported, and network access. "Network Access" is a bit vague. It sounds like it could support POP or SMTP, but that the code would have to be written yourself.

The primary modification to your code seems to be the runat attribute added to script blocks. For example, this will log a message on the server:

<script runat="server">
Jaxer.Log.info("hi ray");
</script>

Another value for runat is server-proxy, which is rather cool. The meat of the functions will work on the server side, but the functions are callable from the front end. This is similar to the cfajaxproxy tag built in ColdFusion.

And lastly (again though - I'm guessing) is the "both" value. This lets you use a function both server side and client side. Here is an example from their sample code:

<!-- This script block will be available on both client and server since the
runat attribute is set to 'both'. -->
<script type="text/javascript" runat="both">
/*
* Easy access to a named element in the DOM
*/
function $(id)
{
return document.getElementById(id);
}
</script>

As I mentioned above, Jaxer will parse up your source code and return it modified. Using the example I mentioned earlier with the Logging, when I viewed the result in my browser, it was removed from the source.

ComparativeStack.png

Read more from Raymond Camden. Raymond Camden's Atom feed cfjedimaster on Twitter

Comments

5 Comments

Are you working on anything specific? I'd love to share thoughts and maybe create our own 'best practices'.

If Aptana really wants this to take off they best get along to creating some valuable docs that will help people pick it up.

Also, are you using the pre-built binary and if so on what OS? I've been trying to compile the source for my Ubuntu server but without ANY doc and my lack of source-building, it's certainly a battle uphill.

Lots of questions. :)

1) Am I building anything specific?

No, right now I'm just playing. The lack of proper docs is a bit painful.

2) Am I using the pre-built binary:

Yes, I'm using it on Leopard. I did NOT do the 'Apache' integration, I'm just using the text server. I would like to so I can test a mixed ColdFusion/Jaxer environment, but I need to find a bit more time.

I'm a bit surprised no one on the Jaxer team has commented here yet. :)

davey said:

@raymond, Just came across your post. With regards to the documentation, we are underway on a relayout of the docs. We actually have a fair amount of content but we need to organize in much more accessible way than it is currently.

You should see a much improved doc structure in the next week or so.

@andrew, the self build stuff on linux is quite difficult, we'll happily try and give you whatever pointers we can, just keep posting your questions to the forums.

In the meantime you can use the drupal searching to find the posted jaxer content on the site.

http://www.aptana.com/search/node/jaxer+type%3Apage

we are working to get this indexed and published in a way that looks more like a book/user guide.

If you have any questions about the product, just ping us on the forums and we'll be happy to help solve the issue.

cheers
davey

davey - sounds good. Can you post a comment here again when the docs are updated?

Top notch davey, thanks for the hard work.

Leave a comment


Tag Cloud

Question of the Week: Dream App

If you had an unlimited budget and unlimited resources what application would you build and why would you build it?

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.