I have p:selectOneMenu in my JSF page and when I run my JSF page I am getting the following exception from Converter class.
java.lang.IllegalArgumentException: o
In your getAsObject
method you're doing nothing with your reached value. Here you're going to receive your #{emp.employeeNumber}
, so you have to convert it into an Employee
(probably you'll have to implement a method which loads an Employee
by id using service locator) and return the object itself.
You're also referencing the convertor with an EL (#{employeeConverter}
), you have to do it in a direct way. Finally, the List of elements has to be composed by SelectItem
, in order to make f:selectItems tag work.
Don't assign the string to the item value, you need to assign the converted object (Employee) itself.
change to itemValue="#{emp}"
See BalusC answer on this question.