JSF java.lang.IllegalArgumentException: Cannot convert 5 of type class java.lang.Integer to class

前端 未结 1 1390
伪装坚强ぢ
伪装坚强ぢ 2020-12-22 07:29

i get new Error with converter

javax.faces.component.UpdateModelException: java.lang.IllegalArgumentException: Cannot convert 5 of type class java.lang.Inte         


        
相关标签:
1条回答
  • 2020-12-22 08:07

    I have no idea how your JSF code look like, but I suspect that you're using

    <h:selectOneMenu value="#{bean.group}">
    

    instead of

    <h:selectOneMenu value="#{bean.groupId}">
    

    Your SelectItem[] contains Integer groupId as item values. The value attribute of the h:selectOneMenu must then match this type. The exception message is telling exactly that. The value is submitted as an Integer, but the bean is expecting a Group.

    0 讨论(0)
提交回复
热议问题