The ICEfaces® Developer’s Guide is your manual to developing ICEfaces applications. By reading through this guide, you will: Gain a basic understanding of what ICEfaces is and what it can do for you. Understand key concepts related to the ICEfaces Rich Web Presentation Environment. Examine the details of the ICEfaces architecture. Access reference information for the following: ICEfaces system configuration. JSF Page Markup. Java API reference. JavaScript API reference. Custom Component TLD. Learn to use advanced ICEfaces development features. For more information about ICEfaces, visit the ICEfaces website at: http://www.icefaces.org

Comments 0

Document transcript

Developer’s GuideVersion 1.8CopyrightCopyright 2005-2009. ICEsoft Technologies, Inc. All rights reserved.The content in this guide is protected under copyright law even if it is not distributed with software that includes an end user licenseagreement.The content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed asa commitment by ICEsoft Technologies, Inc.ICEsoft Technologies, Inc. assumes no responsibility or liability for any errors or inaccuracies that may appear in the informationalcontent contained in this guide.ICEfaces is a registered trademark of ICEsoft Technologies, Inc.Sun, Sun Microsystems, the Sun logo, Solaris and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the UnitedStates and in other countries.All other trademarks mentioned herein are the property of their respective owners.ICEsoft Technologies, Inc.

1 Introduction to ICEfacesICEfaces® is the industry’s leading open-source, standards-compliant Ajax-based solution for rapidlycreating enterprise grade, pure-Java rich web applications.ICEfaces provides a rich web presentation environment for JavaServer Faces (JSF) applications thatenhances the standard JSF framework and lifecycle with Ajax-based interactive features. ICEfacesreplaces the standard HTML-based JSF renderers with Direct-to-DOM (D2D) renderers, and introducesa lightweight Ajax bridge to deliver presentation changes to the client browser and to communicate userinteraction events back to the server-resident JSF application. Additionally, ICEfaces provides anextensive Ajax-enabled component suite that facilitates rapid development of rich interactiveweb-based applications. The basic architecture of an ICEfaces-enabled application is shown in Figure 1below.Figure 1 ICEfaces-enabled JSF ApplicationThe rich web presentation environment enabled with ICEfaces provides the following features:• Smooth, incremental page updates that do not require a full page refresh to achieve presentationchanges in the application. Only elements of the presentation that have changed are updatedduring the render phase.• User context preservation during page update, including scroll position and input focus.Presentation updates do not interfere with the user’s ongoing interaction with the application.These enhanced presentation features of ICEfaces are completely transparent from the applicationdevelopment perspective. Any JSF application that is ICEfaces-enabled will benefit.Introduction to ICEfacesICEfaces Developer’s Guide v1.82Beyond these transparent presentation features, ICEfaces introduces additional rich presentationfeatures that the JSF developer can leverage to further enhance the user experience. Specifically, thedeveloper can incorporate these features:• Intelligent form processing through a technique called Partial Submit. Partial Submitautomatically submits a form for processing based on some user-initiated event, such as tabbingbetween fields in a form. The automatic submission is partial, in that only partial validation of theform will occur (empty fields are marked as not required). Using this mechanism, the applicationcan react intelligently as the user interacts with the form.• Server-initiated asynchronous presentation update (Ajax Push). Standard JSF applicationscan only deliver presentation changes in response to a user-initiated event, typically some type ofform submit. ICEfaces introduces a trigger mechanism that allows the server-resident applicationlogic to push presentation changes to the client browser in response to changes in the applicationstate. This enables application developers to design systems that deliver data to the user in a near-real-time asynchronous fashion.ICEfaces Developer’s Guide v1.83Chapter

2 ICEfaces SystemArchitectureWhile it is not necessary to understand the ICEfaces architecture to develop ICEfaces applications, it isgenerally useful for the developer to understand the basic architecture of the system. Of particularrelevance is gaining an understanding of how ICEfaces plugs into the standard JSF framework. Figure 2below illustrates the basic ICEfaces architecture.Figure 2 ICEfaces ArchitectureThe major elements of the ICEfaces architecture include:• Persistent Faces Servlet: URLs with the “.iface” extension are mapped to the Persistent FacesServlet. When an initial page request into the application is made, the Persistent Faces Servlet isresponsible for executing the JSF lifecycle for the associated request.• Blocking Servlet: Responsible for managing all blocking and non-blocking requests after initialpage rendering.ICEfaces System ArchitectureICEfaces Developer’s Guide v1.84• D2D ViewHandler: Responsible for establishing the Direct-to-DOM rendering environment,including initialization of the DOM Response Writer. The ViewHandler also invokes the Parser forinitial page parsing into a JSF component tree.• D2D Parser: Responsible for assembling a component tree from a JSP Document. The Parserexecutes the JSP tag processing lifecycle in order to create the tree, but does this once only foreach page. The standard JSP compilation and parsing process is not supported under ICEfaces.• D2D RenderKit: Responsible for rendering a component tree into the DOM via the DOM ResponseWriter during a standard JSF render pass.• DOM Response Writer: Responsible for writing into the DOM. Also initiates DOM serialization forfirst rendering, and unblocks the DOM Updater for incremental DOM updates.• DOM Serializer: Responsible for serializing the DOM for initial page response.• DOM Updater: Responsible for assembling DOM mutations into a single incremental DOM update.Updater blocks on incremental DOM update requests until render pass is complete, and DOMResponse Writer performs an unblock.• Component Suite: Provides a comprehensive set of rich JSF components that leverage Ajaxfeatures of the bridge and provide the basic building blocks for ICEfaces applications.• Client-side Ajax Bridge: Responsible for ongoing DOM update request generation and responseprocessing. Also responsible for focus management and submit processing.ICEfaces Developer’s Guide v1.85Chapter

3 Key ConceptsThe JSF application framework provides the foundation for any ICEfaces application. As such, anICEfaces application page is composed of a JSF component tree that represents the presentation forthat page, and the backing beans that contain the application data model and business logic. Allstandard JSF mechanisms such as validation, conversion, and event processing are available to theICEfaces application developer, and the standard JSF lifecycle applies. The following sections exploresome of the key concepts and mechanisms that ICEfaces brings to the application developer.Key ConceptsICEfaces Developer’s Guide v1.86Direct-to-DOM RenderingDirect-to-DOM (D2D) rendering is just what it sounds like—the ability to render a JSF component treedirectly into a W3C standard DOM data structure. ICEfaces provides a Direct-to-DOM RenderKit for thestandard HTML basic components available in JSF. The act of rendering a component tree into a DOMvia the ICEfaces Direct-to-DOM RenderKit is illustrated in Figure 3, p. 6.Figure 3 Direct-to-DOM RenderingKey ConceptsICEfaces Developer’s Guide v1.87The way this basic Direct-to-DOM mechanism is deployed in an ICEfaces application involves server-side caching of the DOM and an Ajax bridge that transmits DOM changes across the network to theclient browser where the changes are reassembled in the browser DOM. This process is illustrated inFigure 4.Figure 4 Direct-to-DOM Rendering Via Ajax BridgeWhen the ICEfaces JAR is included in your JSF application, the Direct-to-DOM RenderKit is automaticallyconfigured into the application. There are no other considerations from the developer perspective.Direct-to-DOM rendering is completely transparent in the development process.Key ConceptsICEfaces Developer’s Guide v1.88Incremental, In-place Page UpdatesOne of the key features of Direct-to-DOM rendering is the ability to perform incremental changes to theDOM that translate into in-place editing of the page and result in smooth, flicker-free page updateswithout the need for a full page refresh. This basic concept is illustrated in Figure 5, p. 8.Figure 5 Incremental Update with Direct-to-DOM RenderingAgain, incremental updates are transparent from the development perspective. As the presentationlayer changes during a render pass, those changes are seamlessly realized in the client browser.Armed with incremental Direct-to-DOM rendering, you can begin to imagine a more dynamicpresentation environment for the user. You no longer have to design pages around the full page refreshmodel. Instead, you can consider fine-grained manipulation of the page to achieve rich effects in theapplication. For example, selective content presentation, based on application state, becomes easy toimplement. Components can simply include value bindings on their isRendered attribute toprogrammatically control what elements of the presentation are rendered for any given applicationstate. ICEfaces incremental Direct-to-DOM update will ensure smooth transition within the presentationof that data.Key ConceptsICEfaces Developer’s Guide v1.89Synchronous and Asynchronous UpdatesNormally, JSF applications update the presentation as part of the standard request/response cycle.From the perspective of the server-resident application, we refer to this as a synchronous update. Theupdate is initiated from the client and is handled synchronously at the server while the presentation isupdated in the response. A synchronous update for ICEfaces is illustrated in Figure 6, p. 9.Figure 6 Synchronous UpdatesOne serious deficiency with synchronous updates is that the application requires a client-generatedrequest before it can affect presentation layer changes. If an application state change occurs during aperiod of client inactivity, there is no means to present changing information to the user. ICEfacesovercomes this deficiency with an asynchronous update mode that facilitates driving asynchronouspresentation changes to the client, based on server-side application state changes. The ICEfacesapplication developer is not restricted to the standard request/response cycle of a normal JSFapplication. Again, the Ajax bridge facilitates ongoing asynchronous updates through the use ofasynchronous XMLHttpRequests that are fulfilled when DOM updates become available due to a renderpass. Because the process leverages incremental Direct-to-DOM updates for asynchronous presentationchanges, you can expect these changes to occur in a smooth, flicker-free manner. Figure 7, p. 10illustrates this process.The primary consideration from the developer’s perspective is to identify and implement the triggersthat cause the presentation updates to happen. Trigger mechanisms are entirely under developercontrol and can include standard JSF mechanisms like ValueChangeEvents, or any other outsidestimulus.Because it is important to manage the asynchronous rendering process in a scalable and performantmanner, ICEfaces provides a Server-initiated Rendering API and implementation. See Server-initiatedRendering (Ajax Push), p. 12 for additional discussion.Key ConceptsICEfaces Developer’s Guide v1.810Figure 7 Asynchronous Update with Direct-to-DOM RenderingAsynchronous mode is the default for ICEfaces, but in cases where asynchronous updates are notrequired, ICEfaces can be configured to support synchronous mode only. Running in synchronous modereduces the connection resource requirements for an application deployment. See Asynchronous vs.Synchronous Updates, p. 30 to specify the mode of operation.When ICEfaces is running in asynchronous mode, it is possible for an outstanding request to remainopen for an extended period of time. Depending on the deployment environment, it is possible for along-lived connection to be lost, resulting in the loss of asynchronous updates. ICEfaces providesconnection management facilities that allow the application to react to connection-related errors. SeeConnection Management, p. 11 for additional information.Key ConceptsICEfaces Developer’s Guide v1.811Connection ManagementClient/server connectivity is a key requirement for ICEfaces applications to function. For this reason,ICEfaces provides connection heartbeating and status monitoring facilities in the client-side Ajax bridge,and a Connection Status component to convey connection status information to the user interface.Additionally, ICEfaces provides the ability to automatically redirect to an error page when the connectionis lost. See Connection Management, p. 66 for details on configuring connection management, andICEfaces Custom Components, p. 39 for additional information on the Connection Statuscomponent.Key ConceptsICEfaces Developer’s Guide v1.812Server-initiated Rendering (Ajax Push)Asynchronous update mode in ICEfaces supports server-initiated presentation updates driven fromapplication logic called Ajax Push. In ICEfaces, this is achieved by causing the JSF lifecycle render phaseto execute in reaction to some state change within the application. The PersistentFacesState providesthis API, and facilitates low-level server-initiated rendering on a per-client basis. While this low-levelrendering mechanism looks simple to use, there are a number of potential pitfalls associated with itrelated to concurrency/deadlock, performance, and scalability. In order to overcome these potentialpitfalls, ICEfaces provides a high-performance, scalable Server-initiated Rendering API, and stronglydiscourages the use of the low-level render call.The server-initiated rendering architecture is illustrated in Figure 8.Figure 8 Server-initiated Rendering ArchitectureThe key elements of the architecture are:For detailed information, see Server-initiated Rendering (Ajax Push) APIs, p. 50.Renderable A request-scoped bean that implements the Renderable interface andassociates the bean with a specific PersistentFacesState. Typically, there willbe a single Renderable per client.RenderManager An application-scoped bean that manages all rendering requests throughthe RenderHub and a set of named GroupAsyncRenderers.GroupAsyncRenderer Supports rendering of a group of Renderables. GroupAsyncRenderers cansupport on-demand, interval, and delayed rendering of a group.Key ConceptsICEfaces Developer’s Guide v1.813Partial Submit – Intelligent Form ProcessingICEfaces introduces a fine-grained user interaction model for intelligent form processing within anICEfaces application. In JSF, the normal submit mechanism initiates the JSF application lifecycle, and assuch, capabilities like client-side validation are not supported. Partial submit overcomes these limitationsby tying the JavaScript event mechanism back into the JSF application lifecycle via an automatic submit.This automatic submit is partial in the sense that only partial validation of the form will occur.The Ajax bridge does intelligent focus monitoring to identify the control associated with the partialsubmit, and turns off the required property for all other controls in the form. From here, a normal JSFlifecycle is performed, after which the required properties are restored to their previous state. The neteffect of a partial submit is that the full validation process executes, but empty fields in the form arenot flagged as invalid. Figure 9 illustrates partial submit based on an onBlur JavaScript event that occursas the user tabs between controls in a form.The client-side Ajax bridge provides a convenience function for tying JavaScript events to the partialsubmit mechanism. The API details can be found in JavaScript API Reference, p. 26, but themechanism relies on only a small snippet of JavaScript being defined in the specific JavaScript attributefor the JSF component instance that is intended to cause the partial submit.The granularity at which partial submits occur is entirely under developer control. In certain cases, itmay be appropriate to evaluate and react to user input on a per-keystroke-basis, and in other cases, itmay be appropriate as focus moves between controls. In still other cases, only specific controls in theform would initiate a partial submit.Figure 9 Partial Submit Based on OnBlurThe backing application logic associated with a partial submit is also entirely under developer control.The standard JSF validator mechanism can be leveraged, or any other arbitrarily complex or simpleevaluation logic can be applied. If standard JSF validators are used, it is important to design thesevalidators to facilitate partial submits.Key ConceptsICEfaces Developer’s Guide v1.814The Address Form demo from the ICEfaces samples illustrates a couple of different mechanisms thatcan be leveraged under a partial submit. Standard validators are attached to City, State, and ZIP inputfields to catch invalid entries, but inter-field evaluation on the {City:State:ZIP}-tuple is also performed.Using valueChangedEvents associated with these input controls, it is possible to do inter-field analysisand morph the form based on current input. For example, entering a valid City will cause the State inputcontrol to change from an input text control to a select-one-of-many controls containing only the Statesthat have a matching City.Key ConceptsICEfaces Developer’s Guide v1.815Components and StylingJSF is a component-based architecture, and as such, JSF application User Interfaces are constructedfrom a set of nested components. The JSF specification includes a number of standard components,but also provides for adding custom components to the JSF runtime environment. This extensiblecomponent architecture is leveraged in ICEfaces to support the standard components as well as severalcollections of custom components.From the developer’s perspective, a component is represented with a tag in a JSF page, and the taglibrary descriptor (TLD) for that tag defines a component class, and a renderer class for the component.At runtime, TLDs configured into the web application are parsed, and assembled into a RenderKit, thedefault for JSF being the html_basic RenderKit. ICEfaces utilizes the html_basic RenderKit but replacesstandard HTML renderers with Direct-to-DOM renderers.Table 1 identifies the component libraries (name spaces) that ICEfaces supports.Table 1 ICEfaces-supported Component Libraries.See Components Reference, p. 34 for more information on using the component libraries withICEfaces.Cascading Style Sheets (CSS) StylingThe purpose of Cascading Style Sheets (CSS) is to separate style from markup. ICEfaces encouragesand supports this approach in the ICEfaces Component Suite by supporting automated componentstyling based on common CSS class definitions. This means that when the ICEfaces Component Suiteis used to develop applications, those applications can be quickly and consistently re-skinned with adifferent look by replacing the CSS with a new CSS. More information about styling the ICEfacesComponent Suite can be found in Styling the ICEfaces Component Suite, p. 41.Name SpaceDescriptionICEfaces Featureswww.icesoft.com/icefaces/component ICEfaces Component Suite • Comprehensive set of richcomponents• Incremental page update• Automated partial submit• Automated CSS styling/themes• Client-side effects and animationsjava.sun.com/jsf/html Sun Standard JSF Components • Incremental page updatemyfaces.apache.org/tomahawk Apache MyFaces TomahawkComponents• Incremental page updateKey ConceptsICEfaces Developer’s Guide v1.816Other Custom ComponentsICEfaces adheres to the extensible component architecture of JSF, and therefore supports inclusion ofother custom components. Most existing custom components that use HTML-based renderers shouldintegrate seamlessly into an ICEfaces application. However, if the component renderer incorporatessignificant JavaScript in its implementation or relies on Ajax techniques itself for its functionality, thelikelihood of a conflict between the component JavaScript and the ICEfaces Bridge JavaScript is high,and can result in unpredictable behavior.The most effective way to incorporate a new component into an ICEfaces application is to develop astandard JSF custom component that uses the ResponseWriter mechanism to render HTML markup. Foran example of such a component, refer to the ice:inputText component renderer implementation, whichcan be found in the following file in the ICEfaces source distribution bundle:icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/InputTextRenderer.javaKey ConceptsICEfaces Developer’s Guide v1.817Drag and DropICEfaces includes support for dragging and dropping components using the script.aculo.us library. Anyice:panelGroup instance can be set to be draggable or a drop target.For example, to make a panelGroup draggable, set the draggable attribute to true.<ice:panelGroup draggable="true">The panel group (and all of its child components) can now be dragged around the screen.Any panelGroup can be set to a drop target as well by setting the dropTarget attribute to true.<ice:panelGroup dropTarget="true">When a draggable panel is moved over or dropped on the drop target panel, events can be fired to thebacking beans. These events include Drag Start, Drag Cancel, Hover Start, Hover End, and Dropped.Figure 10 Drag and Drop ConceptDraggable panels can optionally have animation effects that modify their behavior and appearancepanels. Table 2 lists these optional effects and their behavior.Table 2 Drag and Drop EffectsSee Creating Drag and Drop Features, p. 104 for details on how to build drag and drop applications.EffectBehaviorrevert When a panel is dropped, it moves back to its starting position.ghosting A ghost copy of the drag panel remains at its original locationduring dragging.solid No transparency is set during dragging.Key ConceptsICEfaces Developer’s Guide v1.818EffectsICEfaces uses the script.aculo.us library to provide animation effects. Effects can be easily invoked oncomponents using the effect attribute. The value of the effect attribute is a value binding expression toa backing bean which returns the effect to invoke.<ice:outputText effect="#{bean.messageEffect}"/>Effects can be customized by modifying the properties of the effect object being used. For example, theeffect duration could be changed. For more information, refer to Adding and Customizing Effects,p. 107.Browser-Invoked EffectsEffects can also be tied to browser events, such as onmouseover.<ice:outputText onmouseovereffect="#{bean.mouseOverEffect}"/>These effects will be invoked each time the mouse moves over the outputText component.See Adding and Customizing Effects, p. 107 for details on how to add effects in your ICEfacesapplication.Key ConceptsICEfaces Developer’s Guide v1.819Concurrent DOM Views

By default, each ICEfaces user can have only one dynamically updated page per web application. Inthis configuration, a single DOM is maintained for each user session. Reloading an ICEfaces pagesynchronizes the browser to the server-side DOM. Opening a new browser window into the sameapplication, however, leads to page corruption as DOM updates may be applied unpredictably to eitherwindow.To allow multiple windows for a single application, concurrent DOM views must be enabled. SeeConfiguring web.xml, p. 29 to configure the web.xml file for concurrent DOM views.With concurrent DOM views enabled, each browser window is distinctly identified with a view numberand DOM updates will be correctly applied to the appropriate window. This introduces some importantconsiderations for the application data model. Managed beans in session scope can now be sharedacross multiple views simultaneously. This may be the desired scope for some states, but typically,presentation-related state is more appropriately kept in request scope. For example:<managed-bean><managed-bean-name>BoxesCheckedBean</managed-bean-name><managed-bean-class>com.mycompany.BoxesCheckedBean</managed-bean-class><managed-bean-scope>request</managed-bean-scope></managed-bean>Note:The ICEfaces request scope is typically longer lived than the request scope for non-dynamicapplications. An ICEfaces request begins with the initial page request and remains active throughuser interactions with that page (such user interactions would normally each require a newrequest). One consideration is that new browser windows and page reloads of the same browserwindow are both regarded as new requests. Therefore, it is important to implement the dynamicaspects of the ICEfaces application so that asynchronous notifications are applied to all activerequests and not just the initial one.For applications that do not make use of Concurrent DOM views and require request scope to last onlyfor the duration of a single user event, “standard request scope” must be enabled. See Configuringweb.xml, p. 29 to configure the web.xml file for “standard request scope”.Table 3 shows a summary of the Managed Bean Scope.Table 3 Managed Bean ScopeStateManaged Bean Scopenone For transient data.request For typical view-related state, request-scope beans will persist through mostuser interaction but not through view changes. This is the recommended scopefor ICEfaces applications that make use of multiple windows.session For state that must be shared across views.application For state that must be shared across users.Key ConceptsICEfaces Developer’s Guide v1.820If concurrent DOM views is configured, and multiple windows are created by the user, ICEfaces uses asingle blocking connection to deliver asynchronous updates to all views in the session. This ensures thatall views remain current without exceeding the maximum connection limit implemented in the browser.When views are destroyed by the user, it may be necessary to release view-specific resources such asthreads or database connections. A listener mechanism has been added to support this.See The DisposableBean Interface, p. 61 for details.Key ConceptsICEfaces Developer’s Guide v1.821Integrating ICEfaces With Existing ApplicationsJSP InclusionICEfaces can be easily integrated with existing JSP-based applications through the dynamic JSPinclusion mechanism. Once you have developed a standalone page with the desired ICEfaces dynamiccontent, simply include that page into your existing JSP page with the following statement:<jsp:include page="/content.iface" />Note:Navigation (such as hyperlinks) from the embedded ICEfaces content will cause the entire pageto be reloaded, but other interaction with the application will be incrementally updated in-placeon the page.Included ICEfaces pages must contain a <body> tag as the current implementation uses this tag as amarker. The contents of the <body> tag is precisely the content that is dynamically inserted into theincluding page. This restriction will be removed in a future release.While using dynamic include is a suitable way to embed ICEfaces content into an existing non-ICEfacesJSP page, using dynamic include to embed content within an ICEfaces JSP page is not recommended.To include the content of one ICEfaces JSP in another ICEfaces JSP, the static inclusion syntax shouldbe used:For JSP:<%@ include file="relativeURL" %>For JSPX:<jsp:directive.include file="relativeURL" />JSF IntegrationIn most cases, the goal of adding ICEfaces to a JSF application will be to transform the entire applicationinto an Ajax application, but there may be reasons for converting only parts over to ICEfaces. To handlesome pages with ICEfaces and other pages with the JSF default mechanism, add the ICEfaces Servletmappings for the ".iface" extension (as described in Configuration Reference, p. 29 of thisdocument) but do not remove the “Faces Servlet” mapping or Servlet initialization. Pages servedthrough the default Faces Servlet are to be handled without ICEfaces. Then, to ensure that Direct-to-DOM renderers are applied to ICEfaces pages only, include “just-ice.jar” rather than “icefaces.jar” inyour web application libraries. This .jar file contains a version of ICEfaces configured with a ViewHandlerthat will process only those pages with a “.iface” extension and a RenderKit that will not override thestandard JSF components (such as <h:commandLink />) with Direct-to-DOM renderers. In thisconfiguration, ICEfaces pages must contain only standard core JSF tags (“f:” tags) and ICEfaces tags(“ice:” tags).Key ConceptsICEfaces Developer’s Guide v1.822FaceletsFacelets is an emerging standard and open source implementation, which provides a templatingenvironment for JSF and eliminates the need for JSP processing. ICEfaces has been integrated withFacelets so the ICEfaces developers can take advantage of its capabilities. You can learn more aboutFacelet development at:https://facelets.dev.java.net/Refer to Steps 6 and 7 in Chapter 4, ICEfaces Tutorial: The TimeZone Application, of theICEfaces Getting Started Guide for details on how to port an existing ICEfaces application to runwith Facelets, and how to leverage Facelet templating to implement ICEfaces applications.ICEfaces Developer’s Guide v1.823Chapter

4 ICEfaces ReferenceInformationThis chapter includes additional information for the following:• JSP Markup Reference• Java API Reference• JavaScript API Reference• Configuration Reference• Components Reference• ICEfaces Component Suite• ICEfaces Library DependenciesICEfaces Reference InformationICEfaces Developer’s Guide v1.824JSP Markup ReferenceICEfaces supports the JavaServer Faces JSP Document syntax, but does not process these documentsvia the standard JSP compilation/execution cycle. Instead, ICEfaces parses input documents directly,and assembles a JSF component tree by executing the given tags. This approach allows preciseadherence to the ordering of JSF and XHTML content in the input document, thereby making the JSPDocument syntax more suitable to web designers. Since Direct-to-DOM rendering makes use of aserver-side DOM containing the output of the current page, it is necessary that the input document bereadily represented as a DOM. This requires that the input be well-formed XML, which is the expectedcase for JSP Documents, but may not be adhered to in certain JSP pages. To handle JSP pages, ICEfacesconverts them into JSP documents on the fly, performing a small set of transformations aimed at well-formedness (such as converting “<br>” to “<br/>”), before passing the document to the parser.While parsing documents directly does resolve ordering problems currently present with JSP and JSF,some restrictions are introduced:• Well-formed XHTML markup is recommended; the conversion process can only repair simple well-formedness errors. In particular, the JSP namespace must be declared (as shown below) in orderfor a JSP document to parse properly.xmlns:jsp="http://java/sun.com/JSP/Page"• JSP directives, JSP expressions and inline Java code are all ignored.• Custom JSP tags are not supported in general as ICEfaces only executes JSP tags initially toassemble the JSF component tree (JSF tags with complex processing may also not function asexpected).• ICEfaces supports the following JSP inclusion mechanisms:— <%@ include %> and <jsp:directive.include />: The contents of the given file will beincluded in the input prior to parsing. This is currently the recommended inclusion mechanismwith this ICEfaces release.— <jsp:include />: The ICEfaces parser initiates a local HTTP request to perform dynamicinclusion. The current session is preserved, but otherwise the inclusion shares no state with theincluding page. If possible, use static inclusion with the current ICEfaces Release.• Deprecated XHTML tags may create unexpected results in certain browsers, and should be avoided.Page authors should use style sheets to achieve stylistic and formatting effects rather than usingdeprecated XHTML presentation elements. In particular, the <font> tag is known to cause issuesin certain browsers.• To produce a non-breaking space in output use “&amp;nbsp;” instead of “&nbsp;”.ICEfaces Reference InformationICEfaces Developer’s Guide v1.825Java API ReferenceRefer to the ICEfaces SDK API included with this release. The API can also be found at:http://documentation.icefaces.org/Refer to the ICEfaces components API included with this release. The API can also be found at:http://documentation.icefaces.org/The javadoc can also be found in the docs directory of this release.ICEfaces Reference InformationICEfaces Developer’s Guide v1.826JavaScript API ReferenceThis section contains information for the following:• Partial and Full Submit• View RemovalPartial and Full SubmitThe ICEfaces Ajax bridge provides a couple of JavaScript functions that developers may find useful incertain situations. The functions are:• iceSubmit(form, component, event)• iceSubmitPartial(form, component, event)The parameters for each are:form: The form that is being submitted.component: The component that is triggering the submit.event: The event that is being handled by the component.In most cases, the components provided with ICEfaces render out and use these functions appropriatelyfor the common use cases. For example, if you use the commandButton component, the renderedoutput from the component binds the iceSubmit function to the button’s onClick() handler. Forcomponents that support the partialSubmit attribute, like the commandButton, setting the partialSubmitattribute to true causes the renderer to bind the iceSubmitPartial function instead. See Table 5, p. 36for a list of components that support the partialSubmit attribute.However, there may be situations where the common usage does not apply or where you would simplylike to customize the behavior of the component. In those cases, you can use the bridge functionsyourself to change how or when the form submission is done.For example, suppose you have a login page where you have a couple of input fields and a login button.Perhaps you would like the login button to stay disabled until you have values for both the usernameand the password. However, the default partial submit behavior is bound to onBlur, so the button cannotbe enabled until the user tabs out of the password field. It is more intuitive to have the login buttonenabled after any text is typed in. This can be done like this:<h:inputSecret id="password"value="#{login.password}"onkeyup="setFocus('');iceSubmitPartial(form,this,event); return false;"redisplay="true" />

Rather than set the partialSubmit attribute to true, which would cause the component to calliceSubmitPartial in onBlur, you can directly call the iceSubmitPartial function in the handler that bestsuits your application design.ICEfaces Reference InformationICEfaces Developer’s Guide v1.827View RemovalUnder normal circumstances ICEfaces automatically handles disposal of server-side state associatedwith a view when that view is closed in the browser. However, in certain portal environments portletscan be removed dynamically from the page without triggering a full page refresh. In this situation,ICEfaces needs to be notified about the portlet removal to properly dispose the view corresponding tothe portlet instance. Failure to do so could result in the view being retained until the user session expiresor is terminated.To facilitate timely view disposal in these cases, ICEfaces provides the disposeOnViewRemoval publicJavascript function that should be invoked by the portal container before it removes the portlet instancefrom the page. The function takes only one parameter which has to be a Javascript string representingthe ID of an element that is the parent of the HTML fragment rendered by ICEfaces.For example, if the the element with id="A" is the parent element rendered by the portal and theelement with id="B" is the ice:portlet container (div) rendered by ICEfaces, the portal container willhave to render a script tag that will wire-up the listener that will invoke ICEfaces’ public functiondisposeOnViewRemoval when the view is closed by the user. In this example, onPortletRemove isjust a fictitious function that registers the callback invoked on portlet removal, which is invoked by theportal container when the user closes the view (this function should be replaced with portal specificcode by the implementor).<div id="A"><script type="text/javascript">onPortletRemove(function() {disposeOnViewRemoval('A');});</script>........<div id="B">........</div>........</div>Bridge Connection Status EventsThe ICEfaces Ajax bridge supports a set of callback APIs that can be used to implement customJavaScript behaviors in response to bridge connection management events. These functions are:• Ice.onSendReceive(id, sendCallback, receiveCallback)• Ice.onAsynchronousReceive(id, callback)• Ice.onServerError(id, callback)Note: The onServerError callback function must provide an argument to receive the body of theerror page content.• Ice.onSessionExpired(id, callback)• Ice.onConnectionTrouble(id, callback)ICEfaces Reference InformationICEfaces Developer’s Guide v1.828• Ice.onConnectionLost(id, callback)The parameters used are described in the following table:By implementing these JavaScript callbacks application developers can create custom indicators andreactions for these events. For example, to show a JavaScript alert popup on session expiry this is whatis needed:<body id="document:body"><script type="text/javascript">Ice.onSessionExpired('document:body', function() {alert('Session has expired!');});</script>ParameterDescriptionid the identifier of an element that is the parent or the child of the element owningthe bridge instance (most of the time is the ‘body’ element)callback callback invoked when event occurssendCallback callback invoked when the request is initiatedreceiveCallback callback invoked when response is receivedICEfaces Reference InformationICEfaces Developer’s Guide v1.829Configuration ReferenceThis section explains some of the main configurations that should be considered when using ICEfaces,but is not comprehensive. For a complete overview of all the available ICEfaces configurationparameters, see Appendix B ICEfaces Configuration Parameter Overview, p. 114.Configuring faces-config.xmlThe icefaces.jar file contains a faces-config.xml file that configures the ICEfaces extensions.Specifically, the configuration file registers the Direct-to-DOM renderers. There is no need for thedeveloper to modify the ICEfaces faces-config.xml.Configuring web.xmlServlet Registration and MappingsThe application’s web.xml file must include necessary Servlet registration and mappings.The ICEfaces Servlets are registered as follows:<servlet><servlet-name>Persistent Faces Servlet</servlet-name><servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class><load-on-startup> 1 </load-on-startup></servlet><servlet><servlet-name>Blocking Servlet</servlet-name><servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class><load-on-startup> 1 </load-on-startup></servlet>The Servlet mappings are established as follows:<servlet-mapping><servlet-name>Faces Servlet</servlet-name><url-pattern>*.jspx</url-pattern></servlet-mapping><servlet-mapping><servlet-name>Persistent Faces Servlet</servlet-name><url-pattern>*.iface</url-pattern></servlet-mapping><servlet-mapping><servlet-name>Persistent Faces Servlet</servlet-name><url-pattern>/xmlhttp/*</url-pattern></servlet-mapping><servlet-mapping>ICEfaces Reference InformationICEfaces Developer’s Guide v1.830<servlet-name>Blocking Servlet</servlet-name><url-pattern>/block/*</url-pattern></servlet-mapping>Defining the Context ListenerThis is a not a parameter, per se, but a listener that is typically configured by default because it sits inicefaces.jar/META-INF/include.tld as:<listener><listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class></listener>The ContextEventRepeater implements both the HttpSessionListener and ServletContextListenerinterfaces and was designed to forward servlet events to different parts of the ICEfaces framework.These events are typically of interest for gracefully and/or proactively keeping track of valid sessionsand allowing for orderly shut down.Application servers that don’t support configuring listeners this way may need to include this listener intheir web.xml document:<listener><listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class></listener>Asynchronous vs. Synchronous UpdatesBy default, ICEfaces runs in asynchronous update mode, which provides support for ICEfaces uniqueserver-initiated rendering (Ajax Push) capabilities. However, many applications do not require the fullcapabilities provided by asynchronous update mode. In these cases, it is recommended thatsynchronous update mode be configured.Synchronous update mode can be enabled application-wide using the ICEfaces context parameter,com.icesoft.faces.synchronousUpdate. Typically this is set in the web.xml file of your webapplication as follows.<context-param><param-name>com.icesoft.faces.synchronousUpdate</param-name><param-value>true</param-value></context-param>There is no advantage to using asynchronous update mode for applications that do not useserver-initiated rendering, and there are additional resource requirements associated with its use. SeeOptimizing Asynchronous Communications for Scalability, p. 70. Synchronous update modeshould be used if your application does NOT use the ICEfaces server-initiated rendering features. Whensynchronous update mode is configured, monitoring and maintaining continuous connections to theserver is not required. Instead, a connection is created for each user-initiated request, just as with anynon-ICEfaces web-application.ICEfaces Reference InformationICEfaces Developer’s Guide v1.831Note:When deploying multiple asynchronous ICEfaces applications to the same applicationserver/host-name, it is necessary to also deploy the ICEfaces Push Server. Refer to Push Server,p. 74. for more information.Concurrent ViewsTo allow multiple windows for a single application, concurrent DOM views must be enabled. This is setthrough the ICEfaces context parameter, com.icesoft.faces.concurrentDOMViews. Typically, thisis set in the web.xml file of your web application:<context-param><param-name>com.icesoft.faces.concurrentDOMViews</param-name><param-value>true</param-value></context-param>Standard Request ScopeTo cause request scope to last only for the duration of a single user event, “standard request scope”must be enabled. This is set through the ICEfaces context parameter,com.icesoft.faces.standardRequestScope.Typically this is set in the web.xml file of your web application:<context-param><param-name>com.icesoft.faces.standardRequestScope</param-name><param-value>true</param-value></context-param>Redirect on JavaScript BlockedSome browsers are configured to block JavaScript interpretation or some browsers cannot interpretJavaScript content. For these instances, ICEFaces can be configured to redirect the browser to a customerror page.This feature can be turned on application-wide using the ICEfaces context parameter,com.icesoft.faces.javascriptBlockedRedirectURI.<context-param><param-name>com.icesoft.faces.javascriptBlockedRedirectURI</param-name><param-value>...custom error page URL....</param-value></context-param>If not specified, by default the server will send an HTTP error code ‘403 - Javascript not enabled’. Thisis to avoid any ambiguity, since the accessed page would be rendered but any interaction with it wouldbe impossible.ICEfaces Reference InformationICEfaces Developer’s Guide v1.832Compressing ResourcesResources such as JavaScript and CSS files can be compressed when sent to the browser, improvingapplication load time in certain deployments. The configuration works independently from the web-server configuration.By default, ICEfaces will compress key resources. This may cause problems in configurations wherebyanother component is also configured to compress resources, such as certain portal containers. Ifnecessary, you can disable it using the ICEfaces context parameter,com.icesoft.faces.compressResources.<context-param><param-name>com.icesoft.faces.compressResources</param-name><param-value>false</param-value></context-param>Further customization of ICEfaces resource compression behavior is possible, such as specifying specificfile types to be compressed. For more information, see the compressResources andcompressResourcesExclusions configuration parameters in Appendix B ICEfacesConfiguration Parameter Overview, p. 114.Busy IndicatorBy default, ICEfaces presents a busy indictor (hourglass cursor) and blocks user-interface events via themouse while a submit or partial-submit is being processed.This feature provides the user with a visualindication that the application is busy and also prevents them from triggering additional submits whilethe previous submit is being processed. This prevents users from “chaining” multiple user interfaceevents/submits while results from previous events are pending, which could result in confusingapplication behavior as the user-interface lags and then “catches” up with the user interactions.This feature can be disabled by specifying the following configuration parameter in the web.xml file ofyour web application:<context-param><param-name>com.icesoft.faces.blockUIOnSubmit</param-name><param-value>false</context-param></context-param>Further customization of ICEfaces Ajax bridge behaviors is possible, such as implementing a custombusy indicator in JavaScript for your application. For more information, see Bridge Connection StatusEvents, p. 27.File UploadApplications that use the ice:fileUpload component must configure the upload servlet:<!-- file upload Servlet --><servlet><servlet-name>uploadServlet</servlet-name><servlet-class>com.icesoft.faces.component.inputfile.FileUploadServletICEfaces Reference InformationICEfaces Developer’s Guide v1.833</servlet-class><load-on-startup> 1 </load-on-startup></servlet>The maximum file upload size can be specified in the web.xml file of your web application as follows:<context-param><param-name>com.icesoft.faces.uploadMaxFileSize</param-name><param-value>1048576</param-value></context-param>If not specified the default value for file upload is 10485760 bytes (10 megabytes).To specify the directory location where uploaded files are stored, the following parameter is used:<context-param><param-name>com.icesoft.faces.uploadDirectory</param-name><param-value>images/upload</param-value></context-param>This parameter works in conjunction with the ice:inputFile component attribute “uniqueFolder” with fourpossible combinations as illustrated in the table below:Note:The default upload directory specified via the configuration parameters above can be overriddenon a per-instance basis via theuploadDirectoryanduploadDirectoryAbsolute

attributes on the ice:inputFile component.uniqueFoldercom.icesoft.faces.uploadDirectorySetNot SetTrue/application-context/uploadDirectory/sessionid//application-context/sessionid/False/application-context/uploadDirectory//application-context/ICEfaces Reference InformationICEfaces Developer’s Guide v1.834Components ReferenceICEfaces supports the following JSF component libraries.Table 4 JSF Component LibrariesThe ICEfaces Component Suite classes and renderers are contained in the icefaces-comps.jar. TheSun Standard JSF Component renderers are contained in the icefaces.jar.ICEfaces Component SuiteThe ICEfaces Component Suite provides a complete set of the most commonly required components.These components offer additional benefits over other JSF component sets, such as:• Optimized to fully leverage ICEfaces Direct-to-DOM rendering technology for seamless incrementalUI updates for all components without full-page refreshes.• Support for additional attributes for ICEfaces-specific features, such as partialSubmit, effects,renderedOnUserRole, etc.• Support for comprehensive component styling via predefined component style sheets that are easilycustomized.• Support for rich client-side component effects, such as fading, expand, collapse, etc.For more details, see ICEfaces Component Suite, p. 36.Standard JSF ComponentsThe standard JSF components as defined in the JSF specification are supported with Direct-to-DOMrenderers. No additional ICEfaces-specific attributes are associated with the standard JSF componenttags. ICEfaces-specific capabilities such as partial submit can be configured into the tag through thestandard JavaScript-specific pass through attributes (e.g., onblur="iceSubmitPartial(form.this.event)").The standard JSF component renderers do not support ICEfaces automated CSS styling.Name SpaceDescriptionICEfaces Featureswww.icesoft.com/icefaces/component ICEfaces Component Suite • Comprehensive set of richcomponents• Incremental page update• Automated partial submit• Automated CSS styling/themes• Client-side effects and animationsjava.sun.com/jsf/html Sun Standard JSF Components • Incremental page updatemyfaces.apache.org/tomahawk Apache MyFaces TomahawkComponents• Incremental page updateICEfaces Reference InformationICEfaces Developer’s Guide v1.835In certain cases it may not be desirable to have the ICEfaces Direct-to-DOM renderers replace thestandard HTML renderers for the “h:” components, such as when you have complete JSF pages thatare based on the standard “h:” component functionality and you do not want ICEfaces processing thesepages. It is possible to configure ICEfaces to correctly support this scenario using the “just-ice.jar”.Refer to JSF Integration, p. 21 for more information.Apache MyFaces Tomahawk ComponentsIt is possible to integrate MyFaces Tomahawk components with ICEfaces and ICEfaces Component SuiteComponents on the same page. Any Tomahawk components used with ICEfaces will benefit fromincremental UI updates. All other aspects of using the Tomahawk components will remain the same.For detailed information on using the MyFaces Tomahawk components with ICEfaces, refer to thisrelated ICEfaces Knowledge Base article, Status of ICEfaces Support for MyFaces TomahawkComponents, which can be found on the ICEsoft Online Support Center(http://support.icesoft.com).ICEfaces Reference InformationICEfaces Developer’s Guide v1.836ICEfaces Component SuiteThe ICEfaces Component Suite includes enhanced implementations of the JSF standard componentsand additional custom components that fully leverage the ICEfaces Direct-to-DOM rendering technologyand provide additional ICEfaces-specific features, such as automated partial submit, incremental pageupdates, and easily configurable component look-and-feel.Common AttributesThe following are descriptions of the common attributes that apply to the ICEfaces components.renderedOnUserRole The visibleOnUserRole attribute has been re-named torenderedOnUserRole. If user is in given role, this component will berendered normally. If not, nothing is rendered and the body of this tag willbe skipped.enabledOnUserRole If user is in given role, this component will be rendered normally. If not,then the component will be rendered in the disabled state.visible The visible attribute has been added to all the relevant standard extendedcomponents. Used to render the visibility style attribute on the rootelement. Visible values: true || false.Note: If the visible attribute is not defined, the default is visible.disabled The disabled attribute is a Flag indicating that this element must neverreceive focus or be included in a subsequent submit. Unlike the readOnlywhich is included in a submit but cannot receive focus.partialSubmit The partialSubmit attribute enables a component to perform a partialsubmit in the appropriate event for the component. The partialSubmitattribute only applies to custom and extended components.Table 5, p. 36 shows which attributes are applicable to each ICEfaces component.Table 5 ICEfaces Component AttributesICEfaces ComponentsrenderedOnUserRoleenabledOnUserRolevisibledisabledpartialSubmitcolumn *columnGroup *columnscommandButton * * * * *commandLink * * * * *commandSortHeader * * *dataExporterdataPaginator * * *dataTable *ICEfaces Reference InformationICEfaces Developer’s Guide v1.837effectform * *gMap *graphicImage * *headerRow *inputFile * * *inputHiddeninputRichTextinputSecret * * * * *inputText * * * * *inputTextarea * * * * *loadBundlemenuBar *menuItem * * *menuItems *menuItemSeparator *menuPopup *message * *messages * *outputBodyoutputChart *outputConnectionStatus *outputDeclaration *outputFormatoutputHeadoutputHtmloutputLabel * *outputLink * * * *outputMedia *outputProgress *outputResource *outputStyleoutputText * *ICEfaces ComponentsrenderedOnUserRoleenabledOnUserRolevisibledisabledpartialSubmitICEfaces Reference InformationICEfaces Developer’s Guide v1.838panelBorder *panelCollapsiblepanelConfirmationpanelDivider *panelGrid * *panelGroup * *panelPositionedpanelPopup * *panelSeries *panelStack *panelTabSet *panelTab * * *panelTooltip *portletrowSelectorselectBooleanCheckbox * * * * *selectInputDate * * *selectInputText * * *selectManyCheckbox * * * * *selectManyListbox * * * * *selectManyMenu * * * * *selectOneListbox * * * * *selectOneMenu * * * * *selectOneRadio * * * * *setEventPhasetabChangeListenertreetreeNodeICEfaces ComponentsrenderedOnUserRoleenabledOnUserRolevisibledisabledpartialSubmitICEfaces Reference InformationICEfaces Developer’s Guide v1.839Enhanced Standard ComponentsThe standard JSF components have been enhanced to support ICEfaces partial page rendering,partialSubmit of editable components, and the ability to enable or disable and show or hide componentsbased on user role.The enhanced standard components included in the ICEfaces Component Suite are:• commandButton• commandLink• dataTable— column• form• graphicImage• inputHidden• inputSecret• inputText• inputTextarea• message• messages• outputFormat• outputLabel• outputLink• outputMedia• outputText• panelGrid• panelGroup• selectBooleanCheckbox• selectManyCheckbox• selectManyListbox• selectManyMenu• selectOneListbox• selectOneMenu• selectOneRadioICEfaces Custom ComponentsThe ICEfaces Component Suite also includes a set of custom components that fully leverage theICEfaces Direct-to-DOM rendering technology.The following custom components are provided:• dataExporterICEfaces Reference InformationICEfaces Developer’s Guide v1.840• dataTable— column— columnGroup (new)— columns— commandSortHeader— dataPaginator— headerRow (new)— rowSelector• effect• gMap— gMapControl— gMapDirection— gMapGeoXml— gMapLatLng— gMaplatLngs— gMapMarker• inputFile• inputRichText• loadBundle• menuBar— menuItem— menuItems— menuItemSeparator• menuPopup• outputBody• outputChart• outputConnectionStatus• outputDeclaration• outputFormat• outputHead• outputHtml• outputProgress• outputResource• outputStyle• panelBorder• panelCollapsible• panelConfirmation• panelDividerICEfaces Reference InformationICEfaces Developer’s Guide v1.841• panelGroup• panelPositioned• panelPopup• panelSeries• panelStack• panelTabSet— panelTab• panelTooltip• portlet• selectInputDate• selectInputText• setEventPhase• tree— treeNodeFor more information about the ICEfaces Component Suite, see the following resources:• ICEfaces Component Showcase demo• ICEfaces Component Suite TLD (taglib)Styling the ICEfaces Component SuiteThe ICEfaces Component Suite fully supports consistent component styling via a set of predefined CSSstyle classes and associated images. Changing the component styles for a web application developedwith the ICEfaces Component Suite is as simple as changing the CSS used.A set of predefined style sheets are available to be used as-is, or customized to meet the specificrequirements of the application. There are four predefined ICEfaces style sheets included:• rime.css• rime-portlet.css (for use when developing ICEfaces portlets)• xp.css• xp-portlet.css (for use when developing ICEfaces portlets)• royale.cssThese style sheets provide definitions for all style classes used in the ICEfaces Component Suite. TheICEfaces Component Suite renderers will render default style class attributes based on the style classesdefined in the active style sheets. In order to use these style classes, page developers must specify astyle sheet in their page.Developers may also create their own custom style sheet based on a predefined ICEfaces style sheet.If the style class names match those defined in the ICEfaces style sheets, the ICEfaces components willuse the specified styles by default, without the need to specify the style class names explicitly on eachcomponent.ICEfaces Reference InformationICEfaces Developer’s Guide v1.842Note:The default CSS class names associated with each component are listed in the component’s TLD(taglib) description.The three predefined themes included with ICEfaces each consist of a stylesheet and an imagedirectory. In addition, the Rime and XP themes also include alternate stylesheets (rime-portlet.css andxp-portlet.css) for use when developing ICEfaces portlets.Figure 11, p. 42 shows an example of the CSS directory structure.Figure 11 CSS Directory StructureTo use a predefined theme style sheet with an ICEfaces application, all the page developer needs to dois add the desired CSS link to the page. This can be accomplished in one of two ways:1.Use the ICEfaces ice:outputStyle component (recommended):• Rime<ice:outputStyle href="./xmlhttp/css/rime/rime.css"/>• XP<ice:outputStyle href="./xmlhttp/css/xp/xp.css"/>• Royale<ice:outputStyle href="./xmlhttp/css/royale/royale.css">2.Add a standard HTML link tag to the document:• Rime<link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css" />• XP<link rel="stylesheet" type="text/css" href="./xmlhttp/css/xp/xp.css" />• Royale<link rel="stylesheet" type="text/css" href="./xmlhttp/css/royale/royale.css" />The ice:outputStyle component has the following advantages over the HTML link tag:• Automatically includes browser-specific variants of the main style sheet in the page to adapt thetheme styling to account for differences in each browser’s CSS support. See the TLD (taglib)documentation for the ice:outputStyle component for details.ICEfaces Reference InformationICEfaces Developer’s Guide v1.843• Provides the ability to dynamically change the theme style sheet at runtime via a value binding onthe component’s href attribute.<ice:outputStyle href="#{styleBean.activeTheme}" />Note:In the examples above, the ./xmlhttp/css/xp/ path specifies the location of the predefinedtheme resources in the icefaces.jar file. If you wish to use a custom theme, simply specifyan alternative location for the theme .css file in the href attribute.The resource files for the theme styles can be found in the “resources” directory of the ICEfaces bundle.ICEfaces Focus ManagementICEfaces provides two mechanisms for programatically setting the focus to a specific component on apage:• value-binding on the ice:outputBody component, and• component-binding using the ICEfaces Focus Management API.Controlling Focus with the ice:outputBody ComponentThe ice:outputBody component provides a focus attribute which can be used to statically ordynamically set the client focus on a specific component. Setting the focus attribute value to the id orthe clientId of the component to give focus will move the client browser focus to that component inthe page during the next render immediately following the setting of the focus attribute value. Usingthis mechanism avoids the need for component binding, and provides a straightforward means ofsetting application focus as required.Note:The focus is only set on the client during the render directly following a value change on the focusattribute.Note:To set the initial focus on the page, the component to be focused must be rendered during thefirst render call.Controlling Focus Using the ICEfaces Focus Management APITo use the ICEfaces Focus Management API in your application, you must use component bindings inyour application’s web pages.The ICEfaces Focus Management API consists of a single method, requestFocus(). This method is usedto communicate a component focus request from the application to the client browser.ICEfaces Reference InformationICEfaces Developer’s Guide v1.844All focusable ICEfaces Component Suite components support the requestFocus() method.In the following examples, the ice:inputText is bound to an HtmlInputText instance named westText inthe application backing bean.Example application page:<ice:inputText value="West"binding="#{focusBean.westText}"/>Example application backing bean:import com.icesoft.faces.component.ext.HtmlInputText;