我正在尝试通过从其他 selectonemenu 中选择一些值来更新 selectonemenu。我正在使用<p:ajax update=":main:deviceosName" listener="#deviceRegistration.updateOSName}" />
但侦听器没有调用 updateOSName 方法。在这里,我尝试在使用 id-manufectureName 从 selectonemenu 中选择一些值后使用 id -deviceosName 更新 selectonemenu
另一件事 selectonemenu 与 id-manufectureName 再次更新。
这是我的 xhtml 页面-
<h:form id="main" enctype="multipart/form-data">
<p:growl id="messages" showDetail="true" />
<p:panel id="os_version_panel" header="Os Version">
<h:panelGrid columns="3" title="Os Version" style="width:40%;height:20%;padding:10%;padding-left:30%">
<h:outputLabel for="manufectureName" value="Manufecture Name:*" style="float:right;font-size:15px;width:200px" />
<p:spacer width="20" height="50" />
<p:selectOneMenu id="manufectureName" value="#{deviceRegistration.selectedManufacture}" effect="fade" converter="deviceManufactureConverter"
style="width:200px">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{deviceRegistration.manufactureNameList}" var="manufacturer" itemLabel="#{manufacturer.manufacturersName}"
itemValue="#{manufacturer}" />
<p:ajax event="valueChange" update=":main:deviceosName" listener="#{deviceRegistration.updateOSName}" />
</p:selectOneMenu>
<h:outputLabel for="deviceosName" value="Device OS Name:*" style="float:right;font-size:15px;width:200px" />
<p:spacer width="20" height="50" />
<p:selectOneMenu id="deviceosName" value="#{deviceRegistration.selectedOsName}" effect="fade" converter="deviceOsNameConverter"
style="width:200px">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{deviceRegistration.osNamesList}" var="name" itemLabel="#{name.osName}" itemValue="#{name}" />
</p:selectOneMenu>
<h:outputLabel for="versionName" value="Device OS Version Name:*" style="float:right;font-size:15px;width:200px" />
<p:spacer width="20" height="50" />
<p:inputText id="versionName" value="#{deviceRegistration.selectedVersion.osVersionName}" required="true" label="versionName" size="30">
<f:validateLength minimum="2" />
</p:inputText>
<h:outputLabel for="version" value="Device Os Version:*" style="float:right;font-size:15px;width:200px" />
<p:spacer width="20" height="50" />
<p:inputText id="version" value="#{deviceRegistration.selectedVersion.osVersion}" required="true" label="version" size="30">
<f:validateLength minimum="2" />
</p:inputText>
<f:facet name="footer">
<p:spacer width="20" height="80" />
<p:commandButton id="addOsVersion" value="Add OS Version" actionListener="#{deviceRegistration.addOsVersion}"
action="addversion.xhtml?faces-redirect=true" ajax="false" style="float:right;" />
</f:facet>
</h:panelGrid>
</p:panel>
</h:form>