I need help in this frequent problem in my project.
I want to refresh a list of values list2
based on the currently selected value in another list list1
using a method in my class bean, I want also to use Ajax instead of loading the entire page. The rerender
property is not available in selectOneMenu
.
I have tried:
<h:selectOneMenu id="list1" value="#{bean.currentSelectedObject1}" onchange="submit()"
valueChangeListener="#{bean.methodAct}">
<f:selectItems value="#{bean.listObjects1}" />
</h:selectOneMenu>
The menu that should be updated:
<h:selectOneMenu id="list2" value="#{bean.currentSelectedObject2}">
<f:selectItems value="#{bean.listObjects2}" />
</h:selectOneMenu>
I wonder if I can use some Richfaces tags to do this, or if there is another approach.
UPDATE:
The suggested solution gives me an error: <a4j:ajax> Tag Library supports namespace: http://richfaces.org/a4j, but no tag was defined for name: ajax
I can see a4j:ajaxListener
with only type
attribute but no a4j:ajax
, and also no f:ajax
of any sort, I have looked here, but I am using JSF 2.2
not JSF 2.0
.
Thank you