Asynchronous JavaScript and XML (AJaX)


Ajax is a web technology that enables us to make pages interactive. Ajax is a powerful concept for two reasons. First, it provides a richer experience to the user because the entire page does not need to be reloaded. Second, it shifts some of the burden to the client because the browser requests only a subset of the screen (for example, updated stock quotes or alerts) instead of reloading the entire page.

I have provided an extremely simple example in this book's code zip file (files rapidjava-ajax.html and rapidjava-ajax.jsp). Although this example doesn't truly demonstrate the power of Ajax, it should give you ideas on what we can achieve with this technology. Ajax essentially uses the JavaScript XMLHttpRequest object combined with the <div> HTML tag to provide dynamic updates to only a section of the page.

For introductory information on AJaX, http://en.wikipedia.org/wiki/AJAX might be a good website to start with. However, many books and articles are available on this subject and online search engines such as Google can also turn up many links on this subject.

Also, check out DWR (Direct Web Remoting), an open source framework available at http://getahead.ltd.uk/dwr/. According to the website, "DWR is Easy Ajax for Java." The website further explains that DWR "is a way of calling Java code on the server directly from Javascript in the browser." Note, I have not worked with DWR personally.

One last note about AJaX. What I have demonstrated in my examples is extremely basic. The power of AJaX comes in when little portions of the web UI can make requests to individual services from a collection of services on the backend, in other words, Service-oriented architecture (SOA)[md]this makes for a very powerful concept!



Agile Java Development with Spring, Hibernate and Eclipse
Agile Java Development with Spring, Hibernate and Eclipse
ISBN: 0672328968
EAN: 2147483647
Year: 2006
Pages: 219

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net