When the "select" option of the select one menu is selected, the default value is saved in DB as 0. Can I change this to null? 选择一个菜单的值绑定到一个 bean 属性。为此,我使用了选择一个菜单组件的转换器属性。但它似乎没有将空字符串转换为null。我错过了什么?
<p:panelGrid columns="2" >
<p:outputLabel value="District" />
<p:selectOneMenu value="#{cJData.cJ.dC}" converter="javax.faces.Long">
<p:ajax listener="#{cJActionHandler.selectDC}"/>
<f:selectItem itemLabel="Select" itemValue="" />
<f:selectItems value="#{cJData.DCs}" var="coun"
itemLabel="#{coun.name}" itemValue="#{coun.id}" />
</p:selectOneMenu>
</p:panelGrid>