Converter class throwing exception java.lang.IllegalArgumentException

前端 未结 2 1284
太阳男子
太阳男子 2021-01-24 15:50

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         


        
2条回答
  •  臣服心动
    2021-01-24 16:12

    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.

提交回复
热议问题