Considerations for AJAX implementations
Although AJAX is an exciting technology and provides signifi cant advantages in
terms of performance, usability, and implementation, there are certain
scenarios where using AJAX is not a good fi t. This is especially true when a
lot of custom development is involved in using AJAX libraries.
Some of these are discussed in the following sections.
Global variables
One of the important aspects of portal-specifi c development is the obvious
collision of variables declared at the global page level. Due to the nature of
portals, a page typically consists of multiple portlets with their own local
variables. Creating global variables almost invariably exposes the application
to confl icts with local variables.
One solution might be to assign name spaces along with the variable declaration.
State management
With constant partial page refreshes happening, and content being refreshed
through AJAX implementation, it is very diffi cult to keep the state of the
page consistent. Page refreshes and content refreshes can occur at any given
time, triggered by any portlet on a page. Hence, building a portlet with
dependencies on a page can cause serious problems. Similar issues can crop up
if a user uses the Back button on the browser.
All calls need to be atomic and should use techniques such as cookies to store
states.
Visual cues
Users of web applications prefer to continuously receive the status on their
actions, without which they tend to get impatient or nervous. Most AJAX
functions and calls execute in the background with no obvious sign in the
browser that the user needs to wait and that the browser is busy. Portals with
multiple components on pages sometimes operate independently, further
exacerbating the issue.
Hence, AJAX implementation should always use techniques that provide continuous
visual cues to the user.
Summary
AJAX is a powerful tool. Used appropriately, it can provide tremendous value in
terms of features, usability, performance, and implementation. The
implementation is relatively native and simple with no need for special skills
or plug-ins, other than the ones that web developers normally have. With the
adoption of the Portlet 2.0 specifi cation, AJAX development has become signifi
cantly easier and more reliable. Our example in this chapter showed how easy it
is to develop and deploy AJAX-based portlets.
JBoss portal supplements custom development of portlets enriched with AJAX, with
its own set of pre-packaged baked-in support for features such as AJAX-enabled
layouts, drag-and-drops, partial refreshes, and so on. Portlets can be confi
gured individually to provide or block AJAX features. Although it is powerful,
it also comes with certain limitations. Developers can build a more robust
portal solution using AJAX if they bear in mind these limitations.
Also read
What is a Portlet? Explain its capabilities.
Explain Portal architecture.
What is PortletSession interface?
What is PortletContext interface?
Why portals?...................
|