org.zkoss.jsf.zul
Class Listbox

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by org.zkoss.jsf.zul.impl.AbstractComponent
              extended by org.zkoss.jsf.zul.impl.LeafComponent
                  extended by org.zkoss.jsf.zul.impl.BranchComponent
                      extended by org.zkoss.jsf.zul.impl.BranchOutput
                          extended by org.zkoss.jsf.zul.impl.BranchInput
                              extended by org.zkoss.jsf.zul.impl.BaseListbox
                                  extended by org.zkoss.jsf.zul.Listbox
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, ClientInputSupport, ValueHolderSupport

public class Listbox
extends BaseListbox

Listbox is a JSF component implementation for Listbox, This class also implements EditableValueHolder. That means you can use bidirection value binding, immediate, required, converter, validator, valueChangeListener features on this component.
To use those features, you must decleare a namespace of "http://java.sun.com/jsf/core" with a prefix (say 'f' in below example), add attribute of those feature with this namespace (for example f:required="true")in you jsf page. For more detail of EditableValueHolder features of JSF, you can refer to http://java.sun.com/products/jsp/

You must assign a value on each listitem, so that, after user select listitem and submitting, listbox will decode the request parameter and set back the submitted value to your bean.

When listbox set multiple to false(single selection), then the default binding value of this component is String. When listbox set multiple ot true(multiple selection, then the default binding value of this component is String array.

Example of use bidirection value binding:

 <z:listbox id="role1" f:value="#{yourBean.value}">
        <z:listitem value="1" label="Determine need" />
        <z:listitem value="2" label="Evaluate products/sesrvices" />
        <z:listitem value="3" label="Recommend products/sesrvices" />
        <z:listitem value="4" label="Implement products/sesrvices" />
        <z:listitem value="5" label="Techinical decision maker" />
        <z:listitem value="6" label="Financial decision maker" />
</z:listbox>
 

Example of using immediate:

 <z:listbox f:immediate="true" />
 

Example of using required:

 <z:listbox f:required="true" />
 

Example of using converter:

 <z:listbox f:converter="yourBean.convertMethod"/>
 or
 <z:listbox >
        <f:converter converterId="yourConverterId"/>
 </z:listbox>
 

Example of using validator:

 <z:listbox f:validator="yourBean.validateMethod"/>
 or
 <z:listbox >
        <f:validator validatorId="yourValidatorId"/>
 </z:listbox>
  

Example of using converter:

 <z:listbox >
        <f:valueChangeListener type="your.ValueChangeListener"/>
 </z:listbox>
 

In some application server which doesn't support attribute namespace you can use attribute prefix 'f_' to replace attribute namespace
For example,

 <z:listbox f_value="#{yourBean.value}" />
 

This component should be declared nested under Page.

To know more ZK component features you can refer to http://www.zkoss.org/

Author:
Dennis.Chen
See Also:
Listbox, EditableValueHolder

Field Summary
 
Fields inherited from class org.zkoss.jsf.zul.impl.LeafComponent
_compAttrMap, _composer
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
Listbox()
           
 
Method Summary
 
Methods inherited from class org.zkoss.jsf.zul.impl.BaseListbox
afterZULComponentComposed, clientInputDecode, getMappedAttributeName
 
Methods inherited from class org.zkoss.jsf.zul.impl.BranchInput
addErrorMessage, addValidator, addValueChangeListener, broadcast, compareValues, decode, getConvertedValue, getInputAttributeName, getInputAttributeValue, getSubmittedValue, getValidator, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, restoreState, saveState, setImmediate, setRequired, setSubmittedValue, setValid, setValidator, setValueChangeListener, updateModel, validate, validateValue
 
Methods inherited from class org.zkoss.jsf.zul.impl.BranchOutput
getConverter, getLocalValue, getValue, isLocalValueSet, setConverter, setLocalValueSet, setValue, transferValueForAttribute
 
Methods inherited from class org.zkoss.jsf.zul.impl.BranchComponent
loadZULTree
 
Methods inherited from class org.zkoss.jsf.zul.impl.LeafComponent
addZULDynamicAttribute, encodeBegin, encodeChildren, encodeEnd, evaluateDynaAttributes, getAttributeValue, getComponentDefName, getComponentInfo, getForward, getRendersChildren, getUse, getZULComponent, setAttributeValue, setForward, setId, setUse, setZULDynamicAttribute
 
Methods inherited from class org.zkoss.jsf.zul.impl.AbstractComponent
findAncestorWithClass, getBodyContent, getFacesContext, getFamily, getIf, getUnless, isEffective, isSuppressed, restoreAttachedMapState, saveAttachedMapState, setBodyContent, setIf, setSuppressed, setUnless
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression, setValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.EditableValueHolder
isLocalValueSet, setLocalValueSet
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, getValue, setConverter, setValue
 

Constructor Detail

Listbox

public Listbox()


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.