I m dynamically adding a h:selectOneMenu
to the page. But the listener
method for f:ajax
is not invoked for selectItems but it does work if h:selectOneMenu
had been added to the page from the start (not dynamically added using update
attribute).
My code as follows:
(根据@Daniels建议更正)
<h:commandButton value="Watch">
<f:ajax render="deptsSelBox"/>
<f:setPropertyActionListener value="#{true}" target="#{listRetriever.allow}" />
</h:commandButton>
<h:panelGroup id="deptsSelBox">
<h:selectOneMenu id="deptsSel" rendered="#{listRetriever.allow}" value="#{listRetriever.reqId}">
<f:selectItems value="#{listRetriever.list}" />
<f:ajax listener="#{listRetriever.retrieve()}" execute="deptsSel" />
</h:selectOneMenu>
</h:panelGroup>