简体   繁体   中英

<p:selectOneMenu> getting null on submit/next

I am using primefaces wizard. During wizard flow all parameters saved correctly . However <p:selectOneMenu> items getting NULL on submit.Also on 'back', it will not show what I have selected. Same for <p:selectManyMenu> also. Any solution ?

Here is the code snippets.I'm using primefaces-3.0.M3 and jsf2.

<h:outputText value="Employee Status" />
<p:selectOneMenu id="employeeStatus"value="#{employeeRepositoryImpl.employeeStatus.title}">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItem itemLabel="Permanent" itemValue="Permanent" />
<f:selectItem itemLabel="Contract" itemValue="Contract" />
<f:selectItem itemLabel="Part-Time" itemValue="Part-Time" />
<f:selectItem itemLabel="Training" itemValue="Training" />
</p:selectOneMenu>
<p:message id="employeeStatusId" for="employeeStatus" />

This is in a <p:wizard> tab, while clicking next button or submit button, the itemValues getting null.Sorry for the re-post.

Have you deleted the previous post?

Anyway, firstly, you should upgrade to Primefaces 3.0.M4 !

Secondly, it would be better to use a list along with f:selectItems and all those String values to be stored in a list(this way you have more control over what's in the list and what should the list return), but if you want to stick with f:selectItem try using it with the enclosing tag (it may be a bug without it):

<f:selectItem itemLabel="Permanent" itemValue="Permanent" ></f:selectItem>

Also, I repeat myself, upgrade to Primefaces 3.0.M4!

I have solved it by using primefaces AJAX

<p:ajax update="employeeStatus" listener="#{employeeRepositoryImpl.employeeStatusAjax}" />

inside my </p:selectOneMenu> and I check/process this in side employeeStatusAjax() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM