Roger has posted 2 posts at DZone. View Full User Profile

ICEFaces 2.0 And JSF 2.0 Together

  • submit to reddit

JSF Ajax frameworks have been around for some time. JSF is all about server side components that render their state as markup to the client. JSF has a well defined lifecycle that defines how component state is handled on the server and when component state is rendered to the client.  JSF Ajax frameworks can control which components are processed on the server (known as partial processing), and which components render themselves back to the client (known as partial rendering) by sending Ajax requests with special parameters. 

How ICEFaces Uses JSF 2.0  To Send Ajax Requests

The JSF 2.0 Ajax JavaScript API jsf.ajax.request can be used to trigger Ajax requests from an HTML event such as onclick.  This function can be called from within a JavaScript function too.  ICEFaces uses the jsf.ajax.request function within their JavaScript library:

    submitEvent = function(event, element, form) {
jsf.ajax.request(element, event, {execute: '@all', render: '@all'});

submitForm = function(event, form) {
jsf.ajax.request(form, event, {execute: '@all', render: '@all'});


ICEFaces uses submitEvent and submitForm in their iceSubmitPartial and iceSubmit functions respectively.  The iceSubmitPartial and iceSubmit functions are part of the ICEFaces Ajax Bridge that  communicate with the server.  ICEFaces is using the keyword @all for both execute and render which means that all components are processed on the server, and all components are targeted for rendering markup back to the client.  ICEFaces sends everything because on the server the framework determines the "dirty" regions in a view by comparing the current rendered view with the view that was rendered as a result of the Ajax request.

How ICEFaces Uses JSF 2.0 To Process Ajax Requests On The Server

JSF 2.0 provides extensibility points that allow JSF Ajax frameworks to perform customized partial processing and partial rendering on the server.  The JSF 2.0 API provides the javax.faces.context.PartialViewContext.processPartial method for this purpose.  This method performs partial processing and partial rendering on the components identified by the identifiers in the execute and render lists from the request.  ICEFaces extends javax.faces.context.PartialViewContext with their DOMPartialViewContext impementation:


import javax.faces.context.PartialViewContextWrapper;
public class DOMPartialViewContext extends PartialViewContextWrapper {
public void processPartial(PhaseId phaseId) {
if (isRenderAll() && PhaseId.RENDER_RESPONSE) {
// Perform DOM Diffing ..
// Send updates as separate <update> elements using JSF 2.0 PartialResponseWriter
} else {


If the current processing phase is the Render Response Phase, ICEFaces:
  • retrieves the current DOM (for the view before rendering)
  • generates the new DOM by rendering the new view (using a special DOMResponseWriter)
  • determines if there are differences between the DOMs


If there are differences, then the JSF 2.0 javax.faces.context.PartialResponseWriter implementation is used to write <update> elements back to the client following the specification defined partial response format:

<update id="user">
<update id="password">

If there are no differences, then the JSF 2.0 javax.faces.context.PartialResponseWriter implementation is used to write the single <update> element containing the entire view markup.


ICEFaces 2.0 is still under development, and it is one of the early component frameworks that follow the JSF 2.0 Ajax standard.  It uses the JSF 2.0 Ajax JavaScript API to initiate Ajax requests to the server.  It leverages the JSF 2.0 Ajax extensibility points on the server to process Ajax Requests and formulate the partial response to send back to the client.  This version of ICEFaces (2.0) currently uses the mojarra  implementation of the JSF 2.0 specification.  There will surely be more component frameworks on board with JSF 2.0, which should go a long way towards component interoperability.


ICEFaces 2.0
JavaServer Faces 2.0 Specification
Project Mojarra
Published at DZone with permission of its author, Roger Kitain. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Rj Salicco replied on Fri, 2009/05/29 - 6:43am

Does ICEFaces 2.0 have support for session replication? I have had issues with previous versions of ICEFaces in a clustered environment because it did not support true fail-over. Ran into issues with ICEFaces' implementation for serialization. Nice article. I think JSF-AJAX frameworks have come a long way.

Ted Goddard replied on Fri, 2009/05/29 - 2:48pm

ICEfaces does support session replication, although Ajax Push render groups are maintained in application scope, so need to be rejoined when sessions fail over (transparent failover for render groups will be added in a future release). JSF 2.0 definitely contains improvements to state-saving that should make session replication more efficient. Please let us know the details of any problems you encountered on the ICEfaces forums

stefan asemota replied on Fri, 2009/08/14 - 6:28am

Hello Ted Goddard Interesting article. I am currently in the conception phase of a new Project that should be AA certified (accessibility standards). We will be using Spring, JSF & IceFaces and I was wondering if you have an interesting links on creating a personalized JSF Renderer to render the webpage content accessible to the less privileged??? The idea is basically: there would be an accessibility link which when clicked would renderer the website accessible!! Any ideas would be welcome regards saabir

Kookee Gacho replied on Thu, 2012/05/31 - 6:32am

Source code in Java is written in a text file, this text file is a simple notepad file or a word file. The only difference is that the text or word file is saved with '.txt' or '.doc' extension.-Arthur van der Vant

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.