TOC PREV NEXT INDEX

Putting the TimeZoneBean in Charge


First we change timezone.xhtml, to use Facelets mechanisms, to be more dynamic.

1. Add namespace declarations for Facelets components, and Facelet's implementation of JSTL components and functions:
<f:view xmlns:f="http://java.sun.com/jsf/core"
 
        xmlns:h="http://java.sun.com/jsf/html"
 
        xmlns:ice="http://www.icesoft.com/icefaces/component"
 
        xmlns:ui="http://java.sun.com/jsf/facelets"
 
        xmlns:c="http://java.sun.com/jstl/core"
 
        xmlns:fn="http://java.sun.com/jsp/jstl/functions">
 
2. Pull out the headerDiv section, and put it into header.xhtml to demonstrate parameterized inclusion:
<ui:include src="/header.xhtml">
 
		<ui:param name="sectionName" value="header"/>
 
</ui:include>
 
3. Replace the seven selectBooleanCheckboxes and outputLabels with JSTL forEach sections, that are populated by bean properties using JSF expression language bindings.
<ice:panelGrid columns="#{fn:length(timeZoneBean.allTimeZoneList)}"
 
               width="100%" cellpadding="0" cellspacing="0"
 
               columnClasses="orange, purple, yellow, green">
 
    <c:forEach var="allTimeZone"
 
               items="#{timeZoneBean.allTimeZoneList}">
 
        <ice:panelGroup>
 
            <ice:selectBooleanCheckbox
 
                    id="#{allTimeZone.mapCommandButtonId}" required="false"
 
                    immediate="true"
 
                    value="#{allTimeZone.currentlyShowing}"
 
                    valueChangeListener="#{timeZoneBean.timeZoneChanged}"
 
                    autocomplete="off"/>
 
            <ice:outputLabel value="#{allTimeZone.abbreviation}" />
 
        </ice:panelGroup>
 
    </c:forEach>
 
</ice:panelGrid>
 

 


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