JSF错误和QUOT;期望中的子组件类型...发现空"组件、错误、类型、发现

由网友(一念執著)分享简介:在使用< A4J:载体> 像中所描述的RichFaces例如我改变下拉框的值时,总是得到以下错误。When using the like described in the RichFaces example I'm always getting the following er...

在使用< A4J:载体> 像中所描述的RichFaces例如我改变下拉框的值时,总是得到以下错误。

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.

预计UISelectItem / UISelectItems对儿童的组件类型   组件类型javax.faces.SelectOne(身份识别码)。找到空。

Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(myId). Found null.

下面是JSF的code:

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>

由于 cs.bundeslandList.selectOtherField.selectItems 至少是一个空的的ArrayList ,我敢肯定, otherFieldId 不能

Since cs.bundeslandList.selectOtherField.selectItems is at least an empty ArrayList, I'm certain that otherFieldIdcan't be null.

我已经剥离下来,现在整个页面,我不再得到错误。该 valueChangeListener 正确调用但是不幸的是, otherFieldId 将不会被后刷新呼叫。它清空。但是,在调试的时候,我可以看到相应的属性充满了条目。

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.

推荐答案

&LT吸气; F:selectItems的值GT; 已经在某些时候肯定返回。有没有其他原因的异常。可能你的支持bean code逻辑流程是完全错误的。

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.

请注意,使这个属性静态是一个非常糟糕的主意。这将是对整个Web应用程序的所有其他请求共享。你想让它基于请求或根据最高会议。

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.

阅读全文

相关推荐

最新文章