In p:selectOneMenu loginbranchName value is not set in bean.In selectItems having list of branchName.I'm using listener to select value from list but value not set in getLoginBranchId method....
<h:outputLabel value="Branch Name:*" style="text-align: left;display: block;" rendered="#{loginBean.userLoggedIn}"/>
<p:selectOneMenu value="#{loginBean.loginbranchName}"
rendered="#{loginBean.userLoggedIn}"
style="width:175px;">
<f:selectItem itemLabel="Select" itemValue="0" />
<f:selectItems value="#{loginBean.branchName}" />
<p:ajax event="change" listener="#{loginBean.getLoginBranchId}"/>
</p:selectOneMenu>
login.java
public String getLoginbranchName() {
return loginbranchName;
}
public void setLoginbranchName(String loginbranchName) {
System.out.println("loginbranchName"+loginbranchName);
this.loginbranchName = loginbranchName;
}
public void getLoginBranchId()
{
System.out.println("enter into getloginbranchid");
System.out.println("loginbranchName"+loginbranchName);
int unitId=loginDAO.getLoginBranchId(loginbranchName);
System.out.println("unitId"+unitId);
}
@BalusC was correct regarding the above discussion where, JSF2 can work with List and SelectItem https://stackoverflow.com/tags/selectonemenu/info I think you might be missing
<h:form>
</h:form>
tag.