You need to use t:selectItems.

f:selectItems does not support var or value (at least, it's not supposed to).

On 4/27/07, Joost Schouten <[EMAIL PROTECTED]> wrote:
Hi,

I try to populate a selectItems with a Map from my backing bean (as
described at [1]) but have no success. When I use t:selectItems

<t:selectOneMenu value="#{myBean.loggedAction}">
        <t:selectItems value="#{ myBean.loggedDropDownActions.entrySet}"
var="mapEntry" itemValue="#{mapEntry.key}" itemLabel="#{mapEntry.value}" />
</t:selectOneMenu>

I end up with the dropdown on my page but not populated with any values. A
check on the backend [2] does show there are keys and values set btw.

When I use f:selectItems

<t:selectOneMenu value="#{myBean.loggedAction}">
        <f:selectItems value="#{ myBean.loggedDropDownActions.entrySet}"
var="mapEntry" itemValue="#{mapEntry.key}" itemLabel="#{mapEntry.value}" />
</t:selectOneMenu>

I get the following exception as shown below [3].

Does anyone have any clues?
Thank you,
Joost


[1]: http://www.nabble.com/Using-t:selectItems-with-Map-t3480577.html
[2]:
public Map getLoggedDropDownActions()throws Exception{
        TreeMap mp = new TreeMap();
        ....loading of the values ...
        for(Iterator itr =
this.getSessionVars().getLoggedDropDownActions().entrySet().iterator();itr.h
asNext();){
                Map.Entry temp = (Map.Entry)itr.next();
                log.debug("key: " + temp.getKey() + " | value: " +
temp.getValue());
        }
        return mp;
}


[3]:

java.lang.IllegalArgumentException: Value binding
'#{user_dashboard.loggedDropDownActions.entrySet}'of UISelectItems with
component-path {Component-Path : [Class:
org.apache.shale.view.faces.ShaleViewRoot,ViewId:
/user_dashboard.jsf][Class: org.apache.shale.clay.component.Clay,Id:
clayView][Class: org.apache.shale.clay.component.Clay,Id:
loggedColumnPageLayout][Class: javax.faces.component.html.HtmlOutputText,Id:
_id0][Class: org.apache.shale.clay.component.Clay,Id: _id16][Class:
javax.faces.component.html.HtmlOutputText,Id: _id18][Class:
org.apache.shale.clay.component.Clay,Id: _id20][Class:
javax.faces.component.html.HtmlOutputText,Id: _id30][Class:
org.apache.myfaces.custom.form.HtmlForm,Id: _id32][Class:
org.apache.myfaces.custom.div.Div,Id: _id34][Class:
org.apache.myfaces.component.html.ext.HtmlSelectOneMenu,Id: _id36][Class:
javax.faces.component.UISelectItems,Id: _id37]} does not reference an Object
of type SelectItem, SelectItem[], Collection or Map but of type : null
        at
org.apache.myfaces.shared_tomahawk.util.SelectItemsIterator.hasNext(SelectIt
emsIterator.java:144)
        at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.internalGetSelect
ItemList(RendererUtils.java:473)
        at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getSelectItemList
(RendererUtils.java:451)
        at
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.internal
RenderSelect(HtmlRendererUtils.java:303)
        at
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.renderMe
nu(HtmlRendererUtils.java:276)
        at
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlMenuRendererBase.encod
eEnd(HtmlMenuRendererBase.java:59)
        at
org.apache.myfaces.renderkit.html.ext.HtmlMenuRenderer.encodeEnd(HtmlMenuRen
derer.java:60)


Reply via email to