[jboss-user] [JBoss jBPM] - Re: Combo Box in Form

Riket44 do-not-reply at jboss.com
Fri Jun 15 11:17:36 EDT 2007


Hello,

Well, I will put all my code, because I have an error I can't found (since 2 days !!! )

First, here is my form :

  |     <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>
  | 


Here is my genList.java :

  | public class genList {
  | 
  | 	private String value="";
  | 	private Connection conn;
  | 	
  | 	public genList() {}
  | 	
  | 	public String getValue() {
  | 		return value;
  | 	}
  | 	public void 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;
  | 	}
  | }
  | 

And finally 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>
  | 


When I want to start my process I always have this error :

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, I will be very happy !

Thanks,

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054804#4054804

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054804



More information about the jboss-user mailing list