jsf:selectonemenu未获取最后一个值

jsf:selectonemenu未获取最后一个值,jsf,primefaces,Jsf,Primefaces,每当我从下拉列表中选择最后一个值选项12时,它总是显示第一个选项。除此之外,它工作得很好。如果我去掉这条线 <f:selectItem itemValue="0" noSelectionOption="true" itemLabel="Select One Option" /> 它很好用 有人能给我一些解释,让我可以得到它的工作,包括以上线 ManagedBean JSF页面代码 尝试将f:selectItem更改为以下选项之一: <f:selectItem itemLabe

每当我从下拉列表中选择最后一个值选项12时,它总是显示第一个选项。除此之外,它工作得很好。如果我去掉这条线

<f:selectItem itemValue="0" noSelectionOption="true" itemLabel="Select One Option" />
它很好用

有人能给我一些解释,让我可以得到它的工作,包括以上线

ManagedBean

JSF页面代码


尝试将f:selectItem更改为以下选项之一:

<f:selectItem itemLabel="Select One Option" 
    noSelectionOption="true"/>

<f:selectItem itemValue="#{null}" itemLabel="Select One Option" 
    noSelectionOption="true"/>

选择其他选项11、10。。。etc工作正常?Fared是的,它与其他选项配合良好。基于。我已经试过了,而且成功了。没有noSelectionOption和required=true的itemValue=或itemValue={null}工作正常。我尝试了这两个选项,但都不起作用。但我发现一件糟糕的事情是,如果我删除了一个选项,那么它适用于所有选项,即从1到12。你能告诉我selectOneMenu中的noSelectionOption有什么问题吗?你能试着用h:selectOneMenu代替p:selectOneMenu,然后告诉我这是否有效吗?我已经按照你的建议尝试过了,效果很好。也请看这篇文章。我试着开始工作。
<p:selectOneMenu id="selectReportType" required="true" value="#{reportUitility.reportType}" valueChangeListener="#{reportUitility.valueChangeEffect}">
<f:selectItem itemValue="0" noSelectionOption="true" itemLabel="Select One Option" />
<f:selectItems value="#{reportUitility.list}" />
<p:ajax event="change" update="selectReportType,gradeFrom,gradeTo,exportToXLS,exportToText"/>
  </p:selectOneMenu>
<f:selectItem itemLabel="Select One Option" 
    noSelectionOption="true"/>

<f:selectItem itemValue="#{null}" itemLabel="Select One Option" 
    noSelectionOption="true"/>