users@javaserverfaces.java.net

Re: Binding to a Select One

From: Mikael Andersson <mail.micke_at_gmail.com>
Date: Wed, 23 Jul 2008 14:26:09 +0100

Just a guess but could it be because you haven't set the value expression
for teh UISelectOne object?

Cheers

2008/7/23 TomSimmons <tom.simmons1_at_ge.com>:

>
> I have the following code in my backing bean....
>
> public UISelectOne getDrop()
> {
> if (drop == null)
> drop = new UISelectOne();
>
> UISelectItems items = new UISelectItems();
>
> for (int i = 0; i < 5; i++)
> {
> UISelectItem item = new UISelectItem();
> item.setItemLabel(String.valueOf(i));
> item.setItemValue(String.valueOf(i));
> items.getChildren().add(item);
> }
>
> drop.getChildren().add(items);
>
> return drop;
> }
>
> ...and in the JSP I have....
>
> <h:selectOneMenu binding="#{Reports.drop}"/>
>
> The problem is I always get the following error.....
>
> Expected a child component type of UISelectItem/UISelectItems for component
> type javax.faces.SelectOne(j_id_id47). Found null.
>
> By inspecting the drop object just before it get's returned I can see that
> it contains a UISelectItems,. which has the parent set correctly, and I can
> seel the UISelectItems has multiple UISelectItem object in it, with their
> parent set correctly.
>
> I know this is not the normal way of doing this, but the final goal is
> actually to build all these components in to a dynamically generated
> UIPanelGrid and bind that in the JSP - its a totally dynamic report
> parameter screen. Label, input text and panel grid binding works ok, just
> this SelectOne that is causing me a problem.
>
> Tom
>
> --
> View this message in context:
> http://www.nabble.com/Binding-to-a-Select-One-tp18610023p18610023.html
> Sent from the javaserverfaces users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net
>
>