Monday, February 8, 2010

What is AJAX and what problem does it solve?

Answer
Ajax is a set of client side technologies that allows asynchronous communication between client and web server. In synchronous communication, complete round trip happens with each request/response action event when small data of the page to be refreshed. Ajax has solved this problem of posting entire information every time through asynchronous communication.

XmlHttpRequest is the basic fundamental behind Ajax. This allows browser to communicate with server without making post backs.

What are the benefits of AJAX over Java applet?

The following are the benefits of AJAX over Java applet:

  • AJAX applications are loaded in seconds, where as Applets takes longer time. The reason is, Applet applications are tend to load large libraries.
  • AJAX provides standard look and feel for web applications, where as Applets provides GUI based look and feel.
  • AJAX features can increase from a conventional web application, where as Applets uses complete programming process right from the scratch.
  • Java version changes enable incompatibilities between Applet and java environments used by the browser, where as in AJAX incompatibilities are not the constraints.

What is the disadvantage of AJAX?

The disadvantages of AJAX are:

  • Search engines would not be able to index an AJAX application.
  • The server information can not be accessed within AJAX.
  • AJAX is not well integrated with any browser.
  • ActiveX requests are enabled only in IE 5 and IE6
  • Data of all requests is URL-encoded, which increases the size of the request.

How is encoding handled in AJAX?

AJAX encoding can be done in two ways:

encodeActionURL() method is used for full page refresh
encodeResourceURL() method is used for partial page refresh.

Why is AJAX a comfortable fit with JAVA?

AJAX is a comfortable fit because, using Java Enterprise Edition the following tasks can be performed:

  • AJAX client pages can be generated to server incoming AJAX requests
  • Server side state is managed for AJAX clients
  • AJAX clients can be connected to enterprise resources.

What is synchronous request in AJAX?

Synchronous AJAX is a process that makes a java script to halt or stop the processing an application until a result is sent by a server. The browser is frozen, while the request is processed. The response time is 99.99% quick and fast enough. In case of intrusion for a request or transfer of the file, the browser freezes may be for two minutes until the time is out for the request. The advantages of using synchronous AJAX are, simple to code and can be used in the events ‘onunload’ and ‘onbeforeunload’

When should I use a Java applet instead of AJAX?

  • Applets provide features like custom data streaming, graphic manipulation, threading, and advanced GUIs which AJAX cannot.
  • However, with the help of DHTML, the functionalities of AJAX can be extended further.
  • AJAX requires that the browser be DHTML and AJAX capable.
  • AJAX-based functionality does need to take browser differences into consideration due to which using a JavaScript library such as Dojo which abstracts browser differences is recommended.
  • AJAX/DHTML works well for applications where the latest browsers are used.

How Ajax is different?

An AJAX application introduces a layer between the user and the server which comprises of the AJAX engine. This eliminates the adhoc interaction between the client and the server and makes the application more responsive.

A browser loads an AJAX engine instead of the web page and then communicates with the server on users behalf as well as provides the user with an interface.

As the communication with the server in AJAX is asynchronous, the user doesn’t have to wait for a server response.

Is the server or the client in control in AJAX?

With AJAX the control can be more centralized in a server-side component or a mix of client-side and server-side controllers.

  • Centralized server-side controller
    In this type of architecture, the controller ensures that the data on the client and the server are synchronized.
  • Client and server-side controllers
    In this type of architecture the presentation related control, event processing, page manipulation, and rendering of model data is done through Javascript on the client side.
    The server-side is responsible for business logic and pushing updated model data to the client.
    Both methods are viable depending on the kind of task. However, the centralized server side controller is preferred as in the other case (Client and server-side controllers) the server might not have the knowledge of the state of the client page.

Are there Usability Issues with AJAX?

The nature of updating a page dynamically using data retrieved via AJAX interactions and DHTML may result in drastically changing the appearance and state of a page.

Since the pages get updated dynamically, the state of a page may not remain the same.
So the behavior of a page may need to be defined in each of the following user actions:

  • Navigation using the back or forward buttons of the browser
  • Book-marking a page
  • Sharing a URL
  • Printing a page at any given time

Navigation:
The output of the user actions like a page refresh, forward or back navigation, etc need to be defined.
In this case using a JavaScript framework such as Dojo that provides API's history manipulation and navigation control would be simpler.

Book-marking and URL sharing:
Dojo provides client-side interface for book-marking and URL manipulation.

Printing:
Issues could arise while printing dynamically rendered pages.

No comments:

Post a Comment