Corresponding to the type where the value of the selectOneMenu points
to, you should set the value of the SelectItem to Integer.toString(i)
or another type. But no wrapper Integer is needed.

Apart from this, try it out like Cagatay suggested; This is really
nice solution and more easy to write.

regards,

Gerald

On 9/14/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

I hope ist should be correct. Tell me what You think about, before
I will rewrite the code.

options is a array list with Strings

                        SelectItem[] items = new SelectItem[options.size()];
                        for (int i = 0; i < options.size(); i++) {
                                items[i] = new SelectItem(new Integer(i), 
(String) options.get
(i));
                        }


----Ursprüngliche Nachricht----
Von: [EMAIL PROTECTED]
Datum: 14.09.2006 16:02
An: "MyFaces Discussion"<[email protected]>,
<[EMAIL PROTECTED]>
Betreff: Re: f:selectItems value property

Hi,

you can try it also with:

public List<SelectItem> getSelectItems()
{
 ...
}

but the problem comes from creating a SelectItem. How do you
assign
value and label?

It may also be a need to create a Converter for some type of
values
putting into the "value" property.

regards,

Gerald

On 9/14/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> iI f:selectItems the propery value must be set with a bean
property
> of return type SelectItem[]. Is this not correct?
>
> Thanks
>
> I do the following and get an exception
>
> class Sell {
> ..
> SelectItem[] getArticleConditionOptions()
>
> }
>
>       <h:selectOneMenu>
>   <f:selectItems value="#{sell.articleConditionOptions}" />
>         </h:selectOneMenu>
>
> generates a nexception
>
> Caused by: java.lang.IllegalArgumentException: Value is no
String
> and component _idJsp6:_idJsp13with path: {Component-Path :
[Class:
> javax.faces.component.UIViewRoot,ViewId: /sell.jsp][Class:
javax.
> faces.component.html.HtmlForm,Id: _idJsp6][Class: javax.faces.
> component.html.HtmlSelectOneMenu,Id: _idJsp13]} does not have a
> Converter
> at org.apache.myfaces.shared_impl.renderkit.RendererUtils.
> getConvertedStringValue(RendererUtils.java
>


--
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces






--
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to