UISelectMany on a List<T> causes java.lang.ClassCastException: java.lang.String cannot be cast to T
问题 I am using <p:selectCheckboxMenu> on a List<Long> : <p:selectCheckboxMenu value=\"#{bean.selectedItems}\"> <f:selectItems value=\"#{bean.availableItems}\" /> </p:selectCheckboxMenu> private List<Long> selectedItems; private Map<String, Long> availableItems; When submitting the form and looping over the selected items as below, for (int i = 0; i < selectedItems.size(); i++) { Long id = selectedItems.get(i); // ... } Then I get a class cast exception: java.lang.ClassCastException: java.lang