cancel
Showing results for 
Search instead for 
Did you mean: 

Reading external form values in JavaDelegate

atul1
Champ in-the-making
Champ in-the-making
Hi
I am working on CDI - JSF example , in this example i have use external JSF form for start event in process, where CreateApplicationTask class is JavaDelegate  and   taskForm_newOrder.jsf is external form which shown below.


<startEvent id="startEvent" name="Start" activiti:formKey="taskForm_newOrder.jsf">
      <extensionElements>
        <activiti:executionListener event="end" class="org.bpmnwithactiviti.cdi.task.CreateApplicationTask"></activiti:executionListener>
      </extensionElements>
    </startEvent>


And below is my JSF file  in which there is field inputText  by id isb , from which i need to read value in Javadelegate CreateApplicationTask.  HOw to read that value in delegate class

<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   template="/WEB-INF/templates/template.xhtml">
   <ui:define name="content">
      <f:metadata>
         <!– bind the key of the process to be started –>
         <f:viewParam id="processDefinitionKey" name="processDefinitionKey" />
      </f:metadata>

      <h1>New book order #{processDefinitionKey}</h1>
      <h:form>
         <table>
            <tr>
               <td>ISBN:</td>
               <td><h:inputText id="isb" value=""/>
               </td>
            </tr>
            <tr>
               <td></td>
               <td><h:commandButton value="Submit"
                     action="#{businessProcess.startProcessByKey(processDefinitionKey)}"  actionListener="#{bookOrder.attrListener}" >
                        <f:setPropertyActionListener target="#{bookOrder.appPath}" value="#{bookOrder.isbn}" />
                     </h:commandButton>
               </td>
            </tr>
         </table>
      </h:form>
   </ui:define>

</ui:composition>
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Could you please add more details to your question? Because I don't understand what you are asking right now.

Thanks,

atul1
Champ in-the-making
Champ in-the-making
As we know we can use external form for any task or for start event in process as shown below

—————– from process file————————————-
   <startEvent id="startEvent" name="Start" activiti:formKey="taskForm_newOrder.jsf">
      <extensionElements>
        <activiti:executionListener event="end" class="org.bpmnwithactiviti.cdi.task.CreateApplicationTask"></activiti:executionListener>
      </extensionElements>
    </startEvent>
————————————————————————————–

  here i use " taskForm_newOrder.jsf " as a external Form for start event and CreateApplicationTask java class as JavaDelegate   for start event.
  I want to read JSF Form field in JavaDelegate as soon as start event is end.
 
  Below is the jsf file use as external form and refer as formKey
  In this form ther is textbox by id "isb"  . i want to read that text box value in CreateApplicationTask JavaDelegate.
  How to read the value
 
  ————————————jsf file———————————————–
  <?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
template="/WEB-INF/templates/template.xhtml">
<ui:define name="content">
  <f:metadata>
   <!– bind the key of the process to be started –>
   <f:viewParam id="processDefinitionKey" name="processDefinitionKey" />
  </f:metadata>

  <h1>New book order #{processDefinitionKey}</h1>
  <h:form>
   <table>
    <tr>
     <td>ISBN:</td>
     <td><h:inputText id="isb" value=""/>
     </td>
    </tr>
    <tr>
     <td></td>
     <td><h:commandButton value="Submit"
       action="#{businessProcess.startProcessByKey(processDefinitionKey)}"  actionListener="#{bookOrder.attrListener}" >
        <f:setPropertyActionListener target="#{bookOrder.appPath}" value="#{bookOrder.isbn}" />
       </h:commandButton>
     </td>
    </tr>
   </table>
  </h:form>
</ui:define>

</ui:composition>
——————————————————————————

jbarrez
Star Contributor
Star Contributor
You need to pass the values from your form as a Map<String, Object> of process variables into the engine