public class SelectItemsIndexConverter extends Object implements Converter
The omnifaces.SelectItemsIndexConverter
is a variant of the SelectItemsConverter
which
automatically converts based on the position (index) of the selected item in the list instead of the
Object.toString()
of the selected item.
This converter is available by converter ID omnifaces.SelectItemsIndexConverter
. Just specify it in the
converter
attribute of the selection component holding <f:selectItems>
.
<h:selectOneMenu value="#{bean.selectedItem}" converter="omnifaces.SelectItemsIndexConverter"> <f:selectItems value="#{bean.availableItems}" /> </h:selectOneMenu>
SelectItemsConverter
This converter has the following advantages over SelectItemsConverter
:
Object.toString()
method of the object.SelectItemsConverter
when Object.toString()
method of the object cannot be
used.Object.toString()
,if that's a problem.
This converter has the following disadvantage over SelectItemsConverter
:
SelectItemsUtils
,
SelectItemsCollector
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
Constructor and Description |
---|
SelectItemsIndexConverter() |
Modifier and Type | Method and Description |
---|---|
Object |
getAsObject(FacesContext context,
UIComponent component,
String submittedValue) |
String |
getAsString(FacesContext context,
UIComponent component,
Object modelValue) |
public Object getAsObject(FacesContext context, UIComponent component, String submittedValue)
getAsObject
in interface Converter
public String getAsString(FacesContext context, UIComponent component, Object modelValue)
getAsString
in interface Converter
Copyright © 2012–2016 OmniFaces. All rights reserved.