webtier@glassfish.java.net

Re: [webtier] SelectOne inside Datatable

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Sun, 26 Jul 2009 23:04:16 -0700

On 7/24/09 1:30 AM, webtier_at_javadesktop.org wrote:
> Thanks for the information.
> I have managed to display my domain object collection in HtmlSelectOne, but there is one more problem.
>
> When the Collection is empty, i get this:
>
> java.util.NoSuchElementException
> at com.sun.faces.renderkit.SelectItemsIterator.next(SelectItemsIterator.java:163)
>
> Here is my code:
>
> HtmlSelectOneMenu som = new HtmlSelectOneMenu();
> UISelectItem si0 = new UISelectItem();
> si0.setValue(new SelectItem(0l, "Choose a value"));
> som.getChildren().add(si0);
> UISelectItems si = new UISelectItems();
> si.setValueExpression("value", expression);
> si.setValueExpression("var", createValueExpression("value", String.class));
> si.setValueExpression("itemLabel", createValueExpression("#{value.description}", String.class));
> som.getChildren().add(si);
>
> As you can see, i have inserted a default element at the first index, but not in the collection that selectitems works on.
>
> Why it is mandatory, that selectitems needs at least one element?
>
It's not. The fix will be available in tonight's nightly build.
> [Message sent by forum member 'gabox01' (gabox01)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357391
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>