When using the <a4j:support>
like described in the RichFaces example I'm always getting the following error when changing the value of the drop-down-box.
Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(myId). Found null.
Here's the JSF code:
<h:selectOneMenu id="selectId" valueChangeListener="#{cs.myListener}" value="#{cs.selectList.selectedItem}">
<f:selectItems value="#{cs.bundeslandList.selectItems}" />
<a4j:support event="onchange" reRender="otherFieldId" />
</h:selectOneMenu>
<h:selectOneMenu id="otherFieldId">
<f:selectItems value="#{cs.bundeslandList.selectOtherField.selectItems}" />
</h:selectOneMenu>
Since cs.bundeslandList.selectOtherField.selectItems
is at least an empty ArrayList
, I'm certain that otherFieldId
can't be null
.
I've stripped down now the whole page and I'm no longer getting the error. The valueChangeListener
is called correctly but unfortunately, the otherFieldId
won't be refreshed after the call. It's emptied. But when debugging I can see that the corresponding property is filled with entries.
The getter of <f:selectItems value>
has at some point definitely returned null
. There's no other reason for this exception. Likely your backing bean code logic flow is plain wrong.
Note that making this property static
is a very bad idea. It's going to be shared among all other requests on the entire web application. You want to make it request based or at highest session based.