本文介绍了< p:selectOneMenu>在提交/下一个获取空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用primefaces向导.在向导流程中,所有参数均正确保存.但是<p:selectOneMenu>项目在commit.Alternate上也为NULL,也不会显示我选择的内容. <p:selectManyMenu>也相同.有解决方案吗?

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 ?

这是代码段.我使用的是primefaces-3.0.M3和jsf2.

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" />

这是在<p:wizard>选项卡中,同时单击下一步"按钮或提交"按钮时,itemValues为空.很抱歉重新发布.

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?

无论如何,首先,您应该升级到Primefaces 3.0.M4

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

第二,最好将列表与f:selectItems一起使用,并将所有这些String值存储在列表中(这样,您可以更多控制权对列表中的内容和内容进行控制该列表应该返回),但是如果您想坚持使用f:selectItem,请尝试将其与封闭标签一起使用(没有它可能是一个错误):

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>

此外,我重复一遍,升级到Primefaces 3.0.M4!

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

这篇关于&lt; p:selectOneMenu&gt;在提交/下一个获取空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 01:36