0
設置我編程在overlayPanel一個selectOneMenu用於。問題在於,選定的值在bean中始終爲空。 setter方法沒有被調用,所以我認爲SelectOneMenu沒有被提交,當我選擇一個項目。Primefaces selectOneMenu用於:選擇的項目沒有在Managed Bean的
這裏是我的網頁:
<p:overlayPanel id="OverLayPanelNewRole" for="buttonAddRole">
<p:selectOneMenu id="SelectOneMenuRoles" value="#{userSettingBean.selectedRole}"
onchange="submit()" immediate="true">
<f:selectItems value="#{userSettingBean.roleList}" var="role" itemLabel="#{role.NAME}" style="width:100%"/>
</p:selectOneMenu>
</p:overlayPanel>
我的託管Bean:
@ManagedBean(name = "userSettingBean")
@SessionScoped
public class UserSettingBean implements Serializable {
private static final long serialVersionUID = -7579402702068562565L;
@ManagedProperty(value= "#{roleServiceImpl}")
private RoleService roleService;
private List<Role> roleList;
private Role selectedRole;
@PostConstruct
public void init(){
//init Roles for selection in overlayPanel
roleList=roleService.findAllRole();
}
public RoleService getRoleService() {
return roleService;
}
public void setRoleService(RoleService roleService) {
this.roleService = roleService;
}
public List<Role> getRoleList() {
return roleList;
}
public void setRoleList(List<Role> roleList) {
this.roleList = roleList;
}
public Role getSelectedRole() {
return selectedRole;
}
public void setSelectedRole(Role selectedRole) {
this.selectedRole = selectedRole;
}
任何人可以幫助我解決這個問題?
首先發布您的託管bean代碼。 – Makky
我需要顯示動態生成的角色列表,所以我不能使用'',因爲我不知道顯示了多少個角色。 –
hiaslosch17
嘗試刪除立即=真 –