hello
maybe some one know this, i need have a list o objects merge with other
action selects, my idea is do sometinhg like
<h:selectOneMenu value="#{reoffermanager.interestSelected}"
id="selectFilter"
style="font-family: Verdana, Arial, Helvetica,
sans-serif; font-size: 12px;"
valueChangeListener="#{reoffermanager.changeFilter}"
onchange="submit();">
<f:selectItems
value="#{reoffermanager.listFilter}"/>
<f:selectItem itemValue="-1" itemLabel="Filtros
disponibles" itemDisabled="true"/>
<f:selectItem itemValue="-2"
itemLabel="Filtro"/>
<f:selectItem itemValue="-7" itemLabel="Ocultar
descartados"/>
<f:selectItem itemValue="-8"
itemLabel="Funciones para filtros" itemDisabled="true"/>
<f:selectItem itemValue="-9" itemLabel="Nuevo
Filtro"/>
</h:selectOneMenu>
the list of selectitems i need to load some change in the
valueChangeListener="#{reoffermanager.changeFilter}" if i select some of
this no problem, but when i select other of the selectitem i have this error
j_id_id104:selectFilter: Error de Validación: Valor no es correcto.
j_id_id104:selectFilter: Error de Validación: Valor no es correcto. i 'am
using this converter mi idea is that when i select a selectitem, the
returned value was a new object whith the id of the itamvalue has, <0.
public class InterestConverter implements Converter{
public final Object getAsObject(final FacesContext context,
final UIComponent component, final String value) {
ConstantManager constantsManager=(ConstantManager)
context.getApplication().getELResolver().getValue(
context.getELContext(),
null,"constantManager"
);
if(value==null)
{
return null;
}
Integer id=Integer.valueOf(value);
Interest inter=constantsManager.getInterestById(id);
if(inter!=null)
{
return inter;
}
inter= new Interest();
inter.setInterestedId(id);
return inter;
}
public final String getAsString(final FacesContext context,
final UIComponent component, final Object object) {
if(object==null)
{
return null;
}
if(object instanceof Interest)
{
Interest constant=(Interest) object;
return constant.getInterestedId().toString();
}else if(object instanceof Integer)
{
Integer idAux=(Integer) object;
return idAux.toString();
}else if(object instanceof String)
{
return (String) object;
}else
{
throw new IllegalArgumentException("object:
"+object.getClass().getName()+ " no es constante");
}
}
will be great if some one can help me
thanks