且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

转换器类抛出异常java.lang.IllegalArgumentException

更新时间:2023-01-01 10:13:25

getAsObject 方法中,您对达到的值无效。在这里,您将收到#{emp.employeeNumber} ,因此您必须将其转换为员工 (可能你必须实现一个使用服务定位器通过id加载 Employee 的方法)并返回该对象本身。

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.

您还使用EL引用转换器(#{employeeConverter} ),您必须以直接方式执行此操作。最后,元素列表必须由 SelectItem 组成,以便使 f:selectItems 标记工作。

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.