-
1. Re: Combo Box in Form
riket44 Jun 12, 2007 10:07 AM (in response to riket44)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
kukeltje Jun 12, 2007 5:03 PM (in response to riket44)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
jorges38 Jun 12, 2007 5:27 PM (in response to riket44)Riket44,
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?
Att.,
Jorge
I am also using Jbpm 3.2 GA. -
4. Re: Combo Box in Form
kukeltje Jun 12, 2007 5:37 PM (in response to riket44)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
riket44 Jun 13, 2007 3:51 AM (in response to riket44)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
kukeltje Jun 13, 2007 5:12 AM (in response to riket44)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
jorges38 Jun 13, 2007 10:14 AM (in response to riket44)I am sendig the coding that I have:
faces-config.xml
<!-- Catalog-->
<managed-bean>
<managed-bean-name>product</managed-bean-name>
<managed-bean-class>org.jbpm.webapp.bean.Product</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>product</property-name>
</managed-property>
<managed-property>
<property-name>description</property-name>
#{description}
</managed-property>
<managed-property>
<property-name>situacao</property-name>
#{situacao}
</managed-property>
<managed-property>
<property-name>embalagem</property-name>
#{embalagem}
</managed-property>
<managed-property>
<property-name>tipo</property-name>
#{tipo}
</managed-property>
</managed-bean>
</faces-config>
In the Form:
ex. form.product.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tf="http://jbpm.org/jsf/tf"
xmlns:jbpm="http://jbpm.org/jsf"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt">
.
.
<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}" />
<ui:component>
.
.
<jbpm:datacell>
<f:facet name="header">
Product ID
</f:facet>
<h:outputText value="#{ti.product}"/>
</jbpm:datacell>
.
.
Product.java
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
kukeltje Jun 13, 2007 10:37 AM (in response to riket44)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
roccolocko Jun 13, 2007 1:01 PM (in response to riket44)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" value="#{yourBean.yourProperty}" styleClass="combobox" > <f:selectItems id="yourItemId" value="#{yourBean.yourList}"/> </h:selectOneMenu>
I know its not much but you didn't posted much neither. -
10. Re: Combo Box in Form
kukeltje Jun 13, 2007 6:41 PM (in response to riket44)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
riket44 Jun 15, 2007 11:17 AM (in response to riket44)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, -
12. Re: Combo Box in Form
kukeltje Jun 15, 2007 11:52 AM (in response to riket44)this is generic jsf stuff. please ask in the jsf forums...
-
13. Re: Combo Box in Form
jorges38 Jun 18, 2007 2:46 PM (in response to riket44)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
kukeltje Jun 19, 2007 4:00 AM (in response to riket44)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