Friday, September 16th, 2005

AjaxAnywhere: Ajaxian JSP Components

Category: Java, Library

AjaxAnywhere is designed to turn any set of existing JSP components into AJAX-aware components without complex JavaScript coding.
In contrast to other solutions, AjaxAnywhere is not component-oriented. You will not find here yet another AutoComplete component.
Simply separate your web page into multiple zones, and use AjaxAnywhere to refresh only those zones that needs to be updated.

  • Mark “reload-capable” zones of a web page with AjaxAnywhere custom tags.
  • Instead of submitting a form in traditional way, do it by AjaxAnywhere javascript API.
  • During request processing on the server-side, determine the zones to refresh. (You can implement this logic either on the client-side via JavaScript or on the server-side, via AjaxAnywhere API.)
  • On the server-side AjaxAnywhere will generate an XML containing only the “updated” HTML.
  • On the client-side AjaxAnywhere javascript will receive the XML, parse it and update the selected zones.

Demos

Sample Code

To make an area Ajaxian you need to use a taglibrary and zone the info:

<%@ taglib uri="/WEB-INF/ajaxAnywhere.tld" prefix="aa" %>

<%  ...
    if (AAUtils.isAjaxRequest(request)){
        AAUtils.addZones(request, "countriesList");
    }
 %>
   
<script src="aa/aa.js"></script><script>ajaxAnywhere.formName = "main";</script>

With AjaxAnywhere <br>
<%@ include file="/locales_counter.jsp"%>

<form method="POST" name=main>
<select size="10" name="language" onchange="ajaxAnywhere.submitAJAX();">
    <%@ include file="/locales_options_lang.jsp"%>
</select>
<aa:zone name="countriesList">
<select size="10" name="country" >
    <%@ include file="/locales_options_countries.jsp.jsp"%>
</select>
</aa:zone>
</form>

AjaxAnywhere Home Page

ajaxanyaware.png

Posted by Dion Almaer at 9:34 am
6 Comments

+++--
3.9 rating from 14 votes

6 Comments »

Comments feed

I want to develop my applicaion using ajax so send me sample code

Comment by Yashwant — October 10, 2005

Where can I download AjaxAnywhere.tld?

THX,
Kant

Comment by Kant — November 19, 2005

the TLD in inside the JAR.

The original example uses the following declaretion :

Servlet container automatically finds the tld that is located in ajaxAnywhere.jar

Comment by Vitaliy — January 18, 2006

<%@ taglib uri=”http://ajaxanywhere.sourceforge.net/” prefix=”aa” %

Comment by Vitaliy — January 18, 2006

i don’t get the result when i implementin my pc,
i don’t know what’s wrong, every steps i have followed, the tld, aa.js,
but when i run the locales2.jsp, then i click the country list, there is an error alert : “AjaxAnywhere error : content-type in not text/xml :”,
can u give me any advice ??
first of all, thx..

Rgrds,

Erwin

Comment by Erwin — February 24, 2006

?* My situation */
I wanted to modify my web site with ajaxAnywhere, my web site was implemented with Tiles and struts. Here is its UI structure:
HEADER: dropdown menu, contains links (ForwardAction) to each usecase request
BODY: usecase contents, depends on request action
FOOTER: constant html
/* my purpase */
the page only refresh the body when click on HEADER. actions are still handled by struts
/* my question */
can you give my any advices or send me some sample code the AJAX interact with struts.
THX!
Eddie

Comment by Eddie — March 11, 2006

Leave a comment

You must be logged in to post a comment.