How AJAX works


My friend, if you meant point 1, yes, it can be done. It can be done, not just by JSON but with other XML format as well, moreso with non-XML format. My personal preferrence, SOAP. With the inclusion of Rhino in Mustang, it will not mean that now, we can "finally" support AJAX. It doesn't necessarily be AJAX. Java clients and servers has been consuming and producing XML-based data before in the guise of Web Services, B2B, B2C connectivity and the likes. It has been there, even without Rhino.
If you meant point 2, I tell you, this won't be possible, AFAIK. Rhino and other scripting language made available and embedded within Java are not meant to manipulate UI, just like your JavaScript when you tried your DHTMLs. Rhino, Beanshell, etc. are there to extend business logic. These scripting capabilities was made to create extensibility of business logic by mear definition of the script and not statically defined programatically.
But what is AJAX, really. please refer to the link on the image. You can also buy books or refer to AJAX-related sites and wikis. As you can see, AJAX is composed of the following components, but not necessarily these only. Asynchrony may be achieved with something else, e.g. applets. Data format may also be proprietary. But with this, it ain't AJAX anymore.
- DHTML: XHTML (or HTML) and CSS for presenting information
- The Document Object Model manipulated through JavaScript to dynamically display and interact with the information presented
- The XMLHttpRequest object to exchange data asynchronously with the web server. (XML is commonly used, although any format will work, including preformatted HTML, plain text, JSON and even EBML)
The core presentation engine (AJAX Engine) does not have any defined process as well. All I know is that it acts as controller and mediator between the GUI elements (CSS+JavaScript) and the request/response (XML). You really want to learn more, here's what I can suggest you can dwell into: Java, XML, JavaScript, XML, HTML, CSS/P, Servlets/JSPs. Correct me if I am wrong, but in a nice way. Hope you won't be so violent and vindictive next time. Peace!
You can find the original post and post comments here.
<< Home