Information Technology Reference
In-Depth Information
JSR-168 Portlet
doView()
JSP page
include
1b. AJAX
call
Data
access
object
Data
persistency
Servlet
JavaScript
3. Extracted
value
1a. Definition
2. Marshalled
data
AJAX
Callback
Serialization
AJAX mechanism
FIGURE 11.1
Development model of using AJAX in portal application.
it easy for new AJAX developers to start. The model indicates that
in order to incorporate AJAX into the portlet the action request, which
should be handled by the processAction( ) method in JSR-168 portlet,
is now handled by a servlet. The development model is illustrated
as follows:
1. Create a JSP page that is rendered through the doView( ) method
of a JSR-168 portlet.
2. Write AJAX code in JavaScript, and include this JavaScript in the
JSP page. The procedures of writing AJAX code within JavaScript
is summarized as follows:
(a) initialize the XMLHttpRequest;
(b) dei ne a call-back function that processes the server-side
response;
( c) make AJAX call. This actually makes an HTTP request to the
server by calling the open( ) and send( ) methods of the
XMLHttpRequest object.
3 . Develop a server-side component (i.e., the servlet) to handle the
request from the AJAX call. Usually this involves the operation of
retrieving data from a back-end database. The retrieved data are
marshaled in XML and sent back to the dei ned AJAX call-back
function.
4. Parse the XML within the call-back function using DOM and
DHTML technologies.
 
Search WWH ::




Custom Search