1 2 Previous Next 29 Replies Latest reply on Nov 10, 2007 4:30 PM by Ronald van Kuijk

    Combo Box in Form

    Rick Te Newbie


      I've got a question, here is a part of my form :

      <f:facet name="header">
       <h:outputText value="Produit desire: "/>
       <h:inputText value="#{var['Produit']}" />

      In my database i've got a table named PRODUCT with the ID and the NAME for each product. I wanted to replace the inputText by a combo box in which there will be the NAME of all the products.

      Is it possible ? If yes, I would like to know how do that... Thanks.



      PS: I'm using Jbpm 3.2 GA with MySQL 5.0.

        • 1. Re: Combo Box in Form
          Rick Te Newbie

          If somebody could have an example, it would be ok ;)
          I understand JSF but I don't really understand how to do in jBPM...

          (aaah my bad english, I can't say what I want :) )

          • 2. Re: Combo Box in Form
            Ronald van Kuijk Master

            Do it the same as you normally would. The itemset comes from your database the selected item is just referenced the same way as with an input element.

            • 3. Re: Combo Box in Form
              Jorge Newbie


              Were you able to create de combo box with the item list from de PRODUCT database (external table) ?....I am looking for some samples too.

              I have created de (product.hbm.xml) hibernate file and the Product Class with (getters and setters) and modified the hibernate.cfg.xml....but i am not able to make it work.

              does anyone can help? Any samples?


              I am also using Jbpm 3.2 GA.

              • 4. Re: Combo Box in Form
                Ronald van Kuijk Master

                I am helping... but you guys have to come up with trials and errors which I can comment on. I'm not going to build a full example (unless one of you guys pays my upcoming holiday)

                • 5. Re: Combo Box in Form
                  Rick Te Newbie

                  Do we really need to create an hbm file ??!
                  Usually I have my forms.xml and each forms near : form.product.xhtml, form.example.xhtml ...

                  And for answer to jorges38, no I'm not able to do that for the moment... :(
                  Always looking for an example, I hope some people have one !

                  • 6. Re: Combo Box in Form
                    Ronald van Kuijk Master

                    whether you need a hbm file is dependant on whether you want the object that provides the list to be persistent or not (in jbpm or outside in your domainmodel). For JSF it is not needed. If you want the outcome to be stored in a single jbpm variable (e.g. a string) there is already persistency.....

                    think simple...

                    • 7. Re: Combo Box in Form
                      Jorge Newbie

                      I am sendig the coding that I have:


                      <!-- Catalog-->


                      In the Form:
                      ex. form.product.xhtml

                      <html xmlns="http://www.w3.org/1999/xhtml"
                      <ui:define name="body">
                      <!-- These aliases will save us a lot of typing -->
                      <ui:param name="bean" value="#{taskInstanceBean}"/>
                      <ui:param name="ti" value="#{taskInstanceBean.taskInstance}"/>
                      <ui:param name="td" value="#{taskBean.task}"/>
                      <ui:param name="pd" value="#{processBean.processDefinition}" />
                      <f:facet name="header">
                      Product ID
                      <h:outputText value="#{ti.product}"/>

                      package org.jbpm.webapp.bean;

                      public class Product {
                      private Integer product=1;
                      private String description;
                      private String situacao;
                      private String embalagem;
                      private String tipo;

                      public Integer getProduct(){
                      return produto;

                      public void setProduto(Integer product){
                      this.product = product;

                      public String getDescription(){
                      return description;

                      public void setDescription(String description){
                      this.description = description;

                      public String getSituacao(){
                      return situacao;

                      public void setSituacao(String situacao){
                      this.situacao = situacao;

                      public String getEmbalagem(){
                      return embalagem;

                      public void setEmbalagem(String embalagem){
                      this.embalagem = embalagem;

                      public String getTipo(){
                      return tipo;

                      public void setTipo(String tipo){
                      this.tipo = tipo;


                      • 8. Re: Combo Box in Form
                        Ronald van Kuijk Master

                        here you use your object as a variable type in jbpm. Then you need a hbm file in jbpm.. correct. I normally do not do it this way. We have our domain model outside of the engine.

                        But still.. what is the issue with this? What do you expect from me? I need errors, explicit questions etc.... just (parts of) something is not what I can work with.

                        • 9. Re: Combo Box in Form
                          Roberto Alonso Ramos Zapata Newbie

                          Well, this have nothing to do with JBPM but still here is the change you have to do to create a combo in your JSF page:

                          <h:selectOneMenu id="yourComboId"
                           <f:selectItems id="yourItemId"

                          I know its not much but you didn't posted much neither.

                          • 10. Re: Combo Box in Form
                            Ronald van Kuijk Master

                            Thanks Rocco, I hoped they themselves would have come up with even a simple thing like this.

                            If you change #{yourBean.yourProperty} with e.g. #{proccesVar1} the yourBean does not even have to be a processVariable or whatever. It can be any bean outside jbpm.

                            • 11. Re: Combo Box in Form
                              Rick Te Newbie


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

                              First, here is my form :

                               <f:facet name="header">
                               <h:outputText value="Produit desire: "/>
                               <h:selectOneMenu value="#{genList.value}">
                               <f:selectItems value="#{genList.items}" />

                              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;
                               //-- Connexion
                               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));
                               //-- Deconnexion
                               } catch(Exception e){
                               System.out.println("\n\n\nCONNEXION ECHOUEE: "+e+"\n\n\n");
                               return items;

                              And finally here is my Face Config :

                              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 !


                              • 12. Re: Combo Box in Form
                                Ronald van Kuijk Master

                                this is generic jsf stuff. please ask in the jsf forums...

                                • 13. Re: Combo Box in Form
                                  Jorge Newbie

                                  I am having the same problem:

                                  Argument Error: An option for component mycomboid was not an instance of javax.faces.model.SelectItem. Type found: java.util.ArrayList.

                                  mycomboid = id for the selectOneMenu

                                  Riket44, did you find a solution?

                                  • 14. Re: Combo Box in Form
                                    Ronald van Kuijk Master

                                    please.... what is so difficult about my previous post.... this is JSF stuff, not jBPM. So please ask in the correct forum and learn JSF!!!! Btw.... Google (or Yahoo, Altavista, search.nl or whatever really IS your friend)

                                    JSF, selectitems, example great keywords to search on, but I bet you already figured that out yesterday

                                    1 2 Previous Next