TOC PREV NEXT INDEX

Configuring ICEfaces for Concurrent Views


ICEfaces supports the concept of concurrent DOM viewing, which allows multiple windows or tabs of the same browser to view distinct instances of the same application. Without concurrent DOM viewing, pointing two different browser windows at the same application leads to unpredictable behavior since the server-side DOM would be shared between the two views. You can see what happens by opening two browser windows (of the same browser) and direct both windows to the timezone2 demo. Clicking on various time zones will update one view or the other but not both reliably.

Concurrent DOM viewing ensures each view has its own separate DOM and that backing beans are appropriately scoped for their responsibilities. To configure TimeZone to support concurrent DOM viewing, we need to modify both the deployment descriptor (web.xml or web_myfaces.xml) and the JavaServer Faces configuration file (faces-config.xml).

1. Add a context parameter to the deployment descriptor file (web.xml or web_myfaces.xml) so that ICEfaces is properly configured to support concurrent DOM views:
<context-param>
 
	<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
 
	<param-value>true</param-value>
 
</context-param>
 
2. Now that we are leveraging ICEfaces' server-initiated update feature to push the clock-ticks to the browser, we need to enable asynchronous update mode in the web.xml (or web_myfaces.xml):
<context-param>
 
     <param-name>com.icesoft.faces.synchronousUpdate</param-name>
 
      <param-value>false</param-value>
 
</context-param>
 

 
3. In faces-config.xml, change the scope of the TimeZoneBean from session to request:
<managed-bean>
 
	<managed-bean-name>timeZoneBean</managed-bean-name>
 
	<managed-bean-class>com.icesoft.tutorial.TimeZoneBean</managed-bean-class>
 
	<managed-bean-scope>request</managed-bean-scope>
 
	...
 
</managed-bean>
 

 

This version of TimeZone looks identical to timezone1 and timezone2, but now, you should see the clocks ticking as the page is dynamically updated with each render pass initiated by the bean. With concurrent DOM viewing configured, we can now open timezone3 in two separate browser windows and operate them as if they were two distinct clients with updates and changes being accurately rendered.



Copyright 2005-2009. ICEsoft Technologies, Inc.
TOC PREV NEXT INDEX