I have this:
<h:selectOneMenu id="facility" value="#{document.facility}">
<f:selectItem itemLabel="A" itemValue=""/>
开发者_如何学JAVA<f:selectItem itemLabel="B" itemValue=""/>
<f:selectItems value="#{document.facilities}"/>
<p:ajax actionListener="#{document.test}" update="project" event="change"/>
</h:selectOneMenu>
document
is the managed bean, that has method getFacilities()
that return a list of items, let say C
, D
, F
. So the drop down list would be like:
A
B
C
D
F
If I click on B
, then the method test()
would get invoke. I log it. But if I click on the runtime generated data C
, D
, F
, then the method test()
did not invoke at all. How can I fix this?
The scope of the Managed Bean has to be at least ViewScoped, if u leave the scope by default, which is RequestScoped, it will not work
精彩评论