You ask this befote. The problem seems to be that dataFileItems in the
backing bean should return a Map or an array of SelectItem[].

Change:
public UISelectMany getDataFileItems() ....

To:
public SelectItem[] getDataFileItems() ....


And use as you do like this:
<h:selectManyListbox
binding="#{fileManagementBean.dataFile}" size="7" >
    <f:selectItems
value="#{fileManagementBean.dataFileItems}"/>
</h:selectManyListbox>

As you see, #{fileManagementBean.dataFileItems} binding expression points to
dataFileItems that in your case returns UISelectMany. It should return
SelectItem[] (or a Map)


Regards.
Guillermo.

-----Original Message-----
From: Caroline Jen [mailto:[EMAIL PROTECTED] 
Sent: MiƩrcoles, 12 de Octubre de 2005 11:05 a.m.
To: users@myfaces.apache.org
Subject: I Created a UISelectMany, But, It Was Not Acceptable to the
<f:selectItems>

Please help me.  I have been struggling for days.  If
anybody has the experience.

I got a runtime error:
"java.lang.IllegalArgumentException: Conversion Error
setting value ''{0}'' for ''{1}''. 

com.sun.faces.util.Util.getSelectItems(Util.java:628)"
Usually when we encounter this error using
selectItems, we have to ensure that the method the
SelectItems being returned is NOT NULL.  I have a
getter for what to be rendered in my backing bean. 
Therefore, it seems that what I created for rendering
has some problems.

This is my backing bean:

[code]
public class FileManagementBean 
{
        private UISelectMany dataFileItems;
        protected List dataFile;
        
        public FileManagementBean() 
        {
                dataFileItems = new UISelectMany();
                UISelectItem item = new UISelectItem();
 
                SelectItem file = new SelectItem( "file1", "Data
File No. 1" );
                item.setValue( file );
                dataFileItems.getChildren().add( item );
                file = new SelectItem( "file2", "Data File No. 2" );
                item.setValue( file );
                dataFileItems.getChildren().add( item );
......
......
        }

        public UISelectMany getDataFileItems() {
                return dataFileItems;
        }
        
        public Object[] getDataFile() 
        {
                return dataFile.toArray();
        }
        
        public void setDataFile( Object[] newDataFile ) 
        {
            int len = 0;
                if ( null == newDataFile ||
                   ( len = newDataFile.length) == 0) 
                {
                    return;
                }
                dataFile.clear();
                dataFile = new ArrayList( len );
                for ( int i = 0; i < len; i++ ) 
                {
                    dataFile.add( newDataFile[i] );
                                           }    
        }
}
[/code]

and I tried to create a list box:

[code]
<h:selectManyListbox
binding="#{fileManagementBean.dataFile}" size="7" >
    <f:selectItems
value="#{fileManagementBean.dataFileItems}"/>
</h:selectManyListbox>
[/code]




        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

NOTA DE CONFIDENCIALIDAD
Este mensaje (y sus anexos) es confidencial, esta dirigido exclusivamente a las 
personas direccionadas en el mail y puede contener informacion (i)de propiedad 
exclusiva de Interbanking S.A. o (ii) amparada por el secreto profesional. 
Cualquier opinion en el contenido, es exclusiva de su autor y no representa 
necesariamente la opinion de Interbanking S.A. El acceso no autorizado, uso, 
reproduccion, o divulgacion esta prohibido. Interbanking S.A no asumira 
responsabilidad ni obligacion legal alguna por cualquier informacion incorrecta 
o alterada contenida en este mensaje. Si usted ha recibido este mensaje por 
error, le rogamos tenga la amabilidad de destruirlo inmediatamente junto con 
todas las copias del mismo, notificando al remitente. No debera utilizar, 
revelar, distribuir, imprimir o copiar este mensaje ni ninguna de sus partes si 
usted no es el destinatario. Muchas gracias.


Reply via email to