myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Strittmatter, Stephan" <>
Subject RE: selectItems alsway throw validation error
Date Tue, 27 Mar 2007 12:19:34 GMT
Hi Simon,

probably your Employee-Class is not serializable and do not implement equals?
If it is not implementing equals, every instance is different... 



-----Original Message-----
From: simon.s [] 
Sent: Tuesday, March 27, 2007 2:08 PM
Subject: selectItems alsway throw validation error


I already seached this forum but found no answer for my problem that I hope
is simple to fix.
I have a selectOneListBox that displays Employees that should be selected. I
wrote a converter but I always get a "Wert ist keine g├╝ltige Auswahl" -
means "value is invalid"

Here is my code:

<t:selectOneListbox id="employees" size="1"
    <t:selectItems value="#{peopleHandler.allEmployees}" var="thisItem"
itemLabel="#{thisItem.firstName} #{thisItem.lastName}"
itemValue="#{thisItem}" />

In newSheduleEntryForm
public EmployeeVO getResponsibility() {...}

public void setResponsibility(EmployeeVO responsibility) {...}

in peopleHandler
public List<EmployeeVO> getAllEmployees() {...}

the Converter
public EmployeeVO getAsObject(FacesContext context, UIComponent component,
String value) throws ConverterException {
if ( value == null) return null;
for ( EmployeeVO employee : ps.getAllEmployees())
	if ( employee.getId().toString().equals(value))
		System.out.println("employee found: " + employee.getLastName()); //this is
put to console so the converter works!
		return employee;
throw new ConverterException ("EmployeeConverter.getAsObject: There is no
EmployeeVO for Value " + value + ", type=" + value.getClass().toString());

public String getAsString(FacesContext context, UIComponent component,
Object value) throws ConverterException {
	if ( value == null) return null;
	if (value instanceof EmployeeVO)
		EmployeeVO person = (EmployeeVO) value;
                return person.getId().toString();
        throw new ConverterException ("EmployeeConverter.getAsString: This
is no EmployeeVO, value=" + value.toString() + ", type=" +
View this message in context:
Sent from the MyFaces - Users mailing list archive at

View raw message