5

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 otherFieldIdcan'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.

1 Answers1

5

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • That's a different problem and should technically go in a new question. First step would be to elaborate what exactly you mean with "won't be refreshed". Wasn't it ajax re-rendered? Or did the `` getter just return an empty list? – BalusC Nov 04 '11 at 13:18
  • It was re-rendered, but now it's empty. But I don't know why, since the property is definitely filled. –  Nov 04 '11 at 13:27
  • So, you have put a breakpoint on the getter method and it returned a filled list during render response? – BalusC Nov 04 '11 at 13:32
  • Yes. I've even debugged into the JSF library. There it's also filled. –  Nov 04 '11 at 13:38
  • That can only mean that it's actually not re-rendered at all. With Firebug you should be able to track the changes in HTML DOM tree. – BalusC Nov 04 '11 at 13:42
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/4719/discussion-between-bernhard-v-and-balusc) –  Nov 04 '11 at 13:49