I have worked ( as alpha-alpha-alpha .. ) set of custom components for create AJAX-like user interfaces for Java Server Faces Applications. Main idea - in faces lifecicle, ve have view tree on server side and DOM tree in client browser ( at present, saving tree on client side don't used ). For ajax request, client send all user input of current form ( as normal submit request ). Request phases work as usual, but on render responce phase server send ONLY CHANGED parts of view ( i don't create full compare, but send only fo pre-defined parts, or submitted form ). For this I created special AjaxContainer component, wich render it's children ( or part of children ) components. List of clientId's for rendered components included in response for client-side part of framework. For other cases ( for example, such will work in-page Jabber client ) component can render updated xml in custom Listener, and set responseComplete to FacesContext.
On client side, JavaScript get list of rendered parts and update page DOM Tree. In result, we have two-way communications between client browser and JSF view, and have sync tree's on client and server side. It's work like common desctop applications. Such arch don't need create special RenderKit or change most of components - for example, at present, I have only custom tag's-renderers for UICommand ( link & Button ) components, and have worked all standart and most of custom ( tree2 and any other Myfaces components ) as AJAX ... On other hand, custom renderers based on usual Html renderers, and work also in non-JavaScript environment as simple html... For client side script use XMLHttpRequest object, and, if it don't exist, special "JavaScript"HttpRequest. It's worked same as XMLHttpRequest ( designed with same properies and methods ), but use other idea. For perform request, It appended to page <script> tag. Browser load script ( url maked from form action url with query string as normal GET request ), but script produced by special Filter on server from Html code of JSF Response - as pseudo-Dom tree of objects. Loaded script call handler function for update page - same as XMLHttpRequest. Not need any iframe or other incompatible technologies for non XMLHttpRequest browsers. It can work in wide range of browsers, even in 4+ IE & Netscape ??? ( in theory. At present tested with Mozilla Firefox and IE 5.5+ browsers. I need help for make JavaScript compatible with others. ) At present, XMLHttpRequest work only in Mozilla. Code for MS ActiveX was disabled since I don't can get any functionality of XML part for microsoft object ! Xml parsed withowt errors. ( For xml request, i use in servlet Filter nekkohtml parser, and make valid xml, with all declarations and mime-type headers ). It make responseXML Tree, but any methods for navigate/manipulate don't worked ! Also, elements from responseXML can't be inserted to page, don't produce event handlers etc. Current view of code repository - http://svn.demi.spb.ru/repository/myfaces-ajax/ Project created in Eclipse. Sorry for possible mistakes - my native language is Russian. ======================================== Alexander J. Smirnov