Combo box , error type !
Hello,
I've got an error I can't find since 2 days ! I'm trying to build a simple combo box in which there are some data from my database . It's to deploy a process under jBoss jBPM but the error is a JSF one :
Here is my JSF form code :
<jbpm:datacell>
<f:facet name="header">
<h:outputText value="Produit desire: "/>
</f:facet>
<h:selectOneMenu value="#{genList.value}">
<f:selectItems value="#{genList.items}" />
</h:selectOneMenu>
</jbpm:datacell>
Then, here is my genList.java :
publicclass genList{
private String value="";
private Connection conn;
public genList(){}
public String getValue(){
return value;
}
publicvoid setValue(String value){
this.value = value;
}
public Collection getItems(){
Collection items =new ArrayList();
SelectItem si =null;
try{
//-- Connexion
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/databaseName","root"," ");
//-- Creation du statement et de la requete
Statement stmt = conn.createStatement();
String requete =null;
requete ="SELECT ID_,NOM_ FROM materiel";
//-- Execution de la requete
ResultSet rs = stmt.executeQuery(requete);
//-- Lecture des donnees
while (rs.next())
{
si =new SelectItem (String.valueOf(rs.getInt(1)), rs.getString(2));
items.add(si);
}
//-- Deconnexion
conn.close();
}catch(Exception e){
System.out.println("\n\n\nCONNEXION ECHOUEE: "+e+"\n\n\n");
System.exit(-1);
}
return items;
}
}
Here is my Face config :
<managed-bean>
<managed-bean-name>genList</managed-bean-name>
<managed-bean-class>com.demande.action.genList</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
Finally here is the error returned :
Argument Error: An option for component j_id48 was not an instance of javax.faces.model.SelectItem. Type found: java.util.ArrayList.
(j_id48 is the name given automatically to the combo box)
I tried a lot of things to repair that error, but nothing works... I can't see where is the problem, if you could help me.
Thanks,
Richard T.

