The Next Big Thing



Email    print   
February 1, 2006 —  (Page 1 of 2)
Unless you’ve been living under a rock, you’re probably aware that AJAX seems to be the next big thing. AJAX is not really a technology at all, however—it’s a technique. I’ve been using it in my most recent project, and here are my experiences.

The basic premise of AJAX is to move all the presentation-layer code from the server to the browser. The server presents two types of information to the browser: generic Web pages that contain no data and data streams that contain the information displayed on these pages. That is, instead of creating custom Web pages, the server produces custom data sets for stock Web pages. The data can be sent using XML, but in the application that I’m building, I’ve found that it’s not worth the trouble. I’m just sending comma-separated lists.

At the heart of AJAX is a single JavaScript function call: xmlHttpRequest(). In spite of the name, this is not an XML-related function at all. It simply issues an HTTP GET or POST, and returns the data returned by the browser. On the server side, these requests are handled by standard servlets running under Tomcat. (The Web pages that contain the xmlHttpRequest call are served by Apache, and there’s no need to connect Apache and Tomcat with ModJK since Tomcat isn’t actually serving Web pages—it’s just creating data streams. Tomcat and Apache can be running on separate machines.)

Since it’s JavaScript, you can’t just call xmlHttpRequest, though. The function’s behavior is browser-dependent. Fortunately, you can create a function that wraps the hideous garbage needed to make the function call work.

I found a few useful descriptions of how to make xmlHttpRequest actually work at developer.apple.com/internet/webcontent/xmlhttpreq.html,jibbering.com/2002/4/httprequest.html, www.omnytex.com/articles/xhrstruts (which describe how to use an xmlHttpRequest with Struts), and www.xml.com/lpt/a/2005/02/09/xml-http-request.html. There’s also a really useful set of detailed AJAX examples at www.clearnova.com/ajax.

In my application, all I was doing with Ajax was flowing different chunks of HTML into a <div> element based on user input. Since this is pretty basic JavaScript programming, which I already knew how to do, just figuring out how to make the xmlHttpRequest call was all that I needed. The servlets that responded to the request were trivial to write.




Pages 1 2 


Share this link: http://sdt.bz/29101
 
Most Read Latest News Blog Resources

Add comment


Name*
Email*  
Country     


  • Comment
Loading




close
NEXT ARTICLE
HP + EDS = Big, big, big
HP will pay US$13.9 billion for the services titan, which the company believes will more than double its service revenues and vault it to second place in the industry Read More...
 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 

Download Current Issue
FEBRUARY 2012 PDF ISSUE

Need Back Issues?
DOWNLOAD HERE

Want to subscribe?


 
blogs tab
Are you at risk for burnout?
Burnout is a severe problem and it can strike at any time. Here's how to tell if you are nearing the edge.
02/09/2012 02:16 PM EST

Agility, mom, and apple pie
If we're to evaluate the state-of-the-art in software development, we should start with the values espoused in the Agile Manifesto.
02/07/2012 11:57 AM EST

RIM woos developers with free tablet
How do you get more apps ported to the BlackBerry PlayBook? By giving every developer a free tablet, of course!
02/04/2012 01:57 PM EST

GitHire: Use Headhunters to Find Your Perfect Programmer
Are you a hiring manager tired of scouring the job boards? Check out this new service that will find 5 people interested in your jobs.
02/03/2012 12:17 PM EST

Facebook claims hacker cred
Facebook's SEC S-1 filing form includes a short essay on the Hacker Way by Mark Zuckerberg himself.
02/02/2012 08:26 AM EST

Ryan Dahl steps down
Ryan Dahl, creator of Node.js, steps back from his position as gatekeeper for the project.
02/01/2012 04:58 PM EST

 
Events calendar tab
2/13/2012 to 2/16/2012
Santa Clara
TechWeb

2/26/2012 to 2/29/2012
San Francisco
BZ Media

2/27/2012 to 3/2/2012
San Francisco
RSA

3/4/2012 to 3/7/2012
Las Vegas
IBM Tivoli

3/5/2012 to 3/9/2012
San Francisco
TechWeb