Use enum in h:selectManyCheckbox
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to use enum values in a . The checkboxes get populated correctly, however, when selecting some values and submitting them, their runtime type is String , and not enum. My code: UserController class (SecurityRole is an enum type): public SelectItem[] getRolesSelectMany() { SelectItem[] items = new SelectItem[SecurityRole.values().length]; int i = 0; for (SecurityRole role : SecurityRole.values()) { items[i++] = new SelectItem(role, role.toString()); } return items; } public List getRoles() { getCurrent().getRoles(); } public void