我在这段代码中遇到错误,我被困在这一点上。请帮我。
selectedRole 的 getter 和 setter,allRolesList 包含在代码中
爪哇代码
private String selectedRole;
List<String> allRolesList = new ArrayList<String>();
if(!roleList.isEmpty()){
isRolesPresent = true;
for(UserRole ur : roleList){
allRolesList.add(ur.getRoleName().toString());
/* printing allRolesList results: [admin] */
System.out.print("allRolesList "+allRolesList);
}
}else{
isRolesPresent = false;
}
素面代码:
<p:selectOneMenu id="role" value="#{usersDAO.selectedUser}" effect="fade" required="true"
requiredMessage="Role cannot be null">
<f:selectItems value="#{usersDAO.allRolesList}" />
</p:selectOneMenu>