skip to main content
Gantt > Programmer's documentation > Building Web Applications > Interoperability with third party Web technologies > Supporting JSF 2
 
Supporting JSF 2
Overview
The JViews Web technologies provide fundamental support to Sun™ JSF 2.0 Reference Implementation with following capabilities:
*JViews JSF components work under Sun JSF 2.0 reference implementation run time.
*JViews JSF components support custom component features in JSF 2.
*JViews JSF components support Facelets 2 technologies in JSF 2.
*JViews JSF components support JSF2 Partial Page Rendering technology without using the <f:ajax> tag.
NOTE JViews Web technologies have their own Ajax implementation and do not therefore use the JSF 2 Ajax mechanism. When both JViews JSF components and other JSF 2 components are used on the same page, Ajax requests sent from JViews components do not enter the JSF 2 Ajax queue and are not managed by the JSF 2 Ajax mechanism.
Prerequisites for using JSF 2
To enable the JViews component to support JSF 2 run time, you must add the JSF 2 specific jar to your application classpath. For example:
 
classpath=jviews-jsf2-facelets-support.jar; jviews-xxx-all.jar
Using JViews JSF components to trigger the partial page rendering feature of JSF 2
JViews provides a new JSF 2 specific Facelets interactor called the ajaxInteractor to allow you to trigger the partial page rendering (PPR) feature of JSF 2 without using the <f:ajax> tag.
The ajaxInteractor allows you to trigger PPR actions to other JSF 2 components that you specify. When the user clicks a view that has an ajaxInteractor attached to it, a jsf.ajax.request() query is sent and JSF 2 components with specified IDs are re-rendered without the need to refresh the entire page.
Attributes
Name
Required
Type
Description
id
true
java.lang.String
The ID of this component.
render
true
java.lang.String
The IDs of the components to be rendered by the ajaxInteractor. This component sends a jsf.ajax.request() query to enable the JSF 2 to re-render the specified components.
Separate multiple IDs to be rendered with a space.
Usage
Before you can use the ajaxInteractor, you must ensure that the JSF 2 Ajax JavaScript library has been imported on your page.
The following code example shows how you can import the JSF 2 Ajax JavaScript library:
<h:outputScript name="jsf.js" library="javax.faces" target="head" />
The ajaxInteractor can be combined with any other interactor by using the interactorGroup.
The following code example shows how the ajaxInteractor can be combined with other interactors:
<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:jvf="http://www.ilog.com/jviews/tlds/jviews-framework-faces.tld"
   xmlns:jv="http://www.ilog.com/jviews/tlds/jviews-faces.tld" >
 
<h:body>
   <h:form prependId="false" id="helloForm">
      <h:outputScript name="jsf.js" library="javax.faces" target="head" />
 
      <h:outputText id="out1" value="#{count1.number}" />
      <h:outputText id="out2" value="#{count1.number}" />
 
      <jvf:objectSelectInteractor id="select"
          valueChangeListener="#{frameworkBean.selectObject}"
          invocationContext="IMAGE_SERVLET_CONTEXT" />
      <jv:ajaxInteractor id="ajax" render="out1 out2" />
      <jv:interactorGroup id="interactorGroup" interactors="select ajax" />
      <jvf:view id="view" style="width:500px;height:300px"
          view="#{frameworkBean.view}" interactorId="interactorGroup" />
 
   </h:form>
</h:body>
Using JSF 2 components to render JViews JSF components
To render JViews components, wrap the JViews component with a JSF container tag, for example, h:panelGrid and render the id of this panelGrid.
<h:commandButton id="button1" value="diagrammer"
   onclick="jsf.ajax.request(this,event,{render:'diagrammer_panelgrid'});return false;" />
 
<h:panelGrid id="diagrammer_panelgrid">
   <jvdf:diagrammerView id="diagrammer"
      style="width:500px;height:300px" data="/data/molecule.idpr"/>
</h:panelGrid>

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.