2 Replies Latest reply on May 26, 2010 6:32 PM by Gerardo Navarro Suarez

    Defining a list in a task form, but How?

    Gerardo Navarro Suarez Newbie

      Hi All,

       

      I'm using jbpm 3.2. I try to implement a job application process. At the end of the process all applicants should be listed in a task form, in order to choose an applicant and offer him a job. So there is a process variable which is a list of strings (applicants) and foreach of these list elements there should be a checkbox in the task form.

       

      At the moment I go stuck defining the xhtml for the task form. How can I define such a list of checkboxes?

       

      I think I found a thread in the forum (https://community.jboss.org/message/395789#395789) dealing with a similar problem. But I was not sure. The result in the mentioned thread is that the problem is not possible in jbpm 3. Is that true? Is there maybe another possibility?

       

      Thanks for your help,

       

      Gerardo

        • 1. Re: Defining a list in a task form, but How?
          Alejandro Guizar Master

          This is not really a jBPM question as the engine is able to persist and return a list of strings as variable value. Anyhow, if you are using JSF, you could take a look at what the web console does.

           

          In particular, the web console comes has two supporting tag libraries, gravel and jbpm4jsf. These tag libraries provide a number of tags which you might find useful.

           

          <html xmlns:h="http://java.sun.com/jsf/html"
            xmlns:gd="http://gravel.jboss.org/jsf/1.0/data"
            xmlns:j4j="http://jbpm.org/jbpm4jsf/core">
            ...
            <j4j:loadProcessInstance id="#{id}" target="#{pi}"/>
            <j4j:getVariableMap target="#{vars}" value="#{pi}"/>
            <gd:repeat value="#{vars['applicants']}" var="applicant">
              <h:outputText value="#{applicant}"/>
            </gd:repeat>
          </html>
          

           

          Both the jbpm4jsf and gravel jars are available from the jboss maven repository.

          • 2. Re: Defining a list in a task form, but How?
            Gerardo Navarro Suarez Newbie

            Hola Alejandro,

             

            thank you very much for your help. But I've difficulties to install/integrate the 2 jars (gravels and jbpm4jsf) into my jBPM deployment.

             

            So as you noticed I'm also a newbie in this world. So where do I have to copy the 2 jars in order to use the tags in the code snippet? What do I have to do?

             

            I already tried this snippet in my xhtml page, but an error occurred saying "<j4j:loadProcessInstance> Parent component is not an ActionSource". I assume that the problem is caused by the missing integrated jars.

             

            So I did another try and left out the 2 first tags of the snippet and inserted only these tags into the xhtml. You have to know that the process has a process variable "list" which is a StringArray containing the names of the applicants.

            <gd:repeat value="#{vars['list']}" var="applicant">

                 <h:outputText value="#{applicant}"/>

            </gd:repeat>

             

            So after all this implementation doesn't cause any problem at all and the page were rendered, but no applicant was listed. Is the usage of the tags and the process variable OK?


            I would really appreciate if you or someone could help me again.


            Greetings,


            Gerardo