How to render a external form?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member

How to render a external form?

Hi,

I am using activiti in spring application. I need to render a jsp page by using activiti form properties in my spring application. How can i show fields in my jsp?

6 Replies
Highlighted
Established Member II

Re: How to render a external form?

Hi!

Please, watch: Activiti User Guide 

Regards.

Highlighted
Established Member

Re: How to render a external form?

I checked this. Is any example available for this?

Currently, I am getting properties in java like as below,

List<FormProperty> formProperties = getFormService().getTaskFormData(taskId).getFormProperties();

put it in model of Spring.

At JSP, displayed like as below

<c:forEach items="${formProperties}" var="record">
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">${record.name } <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="${record.id}" name="${record.id}" required="required" class="form-control col-md-7 col-xs-12" value="${record.value}">
</div>
</div>
</c:forEach>

Is any other way to display the fields in my spring application?

Highlighted
Established Member II

Re: How to render a external form?

I don't use JSP but I have a test code, maybe you can use:

@Test
@Deployment(resources = { "org/activiti/test/ProcessWithForm.bpmn20.xml" })
public void testSubmitTaskFormData() throws InterruptedException {
   RuntimeService runtimeService = activitiRule.getRuntimeService();
   TaskService taskService = activitiRule.getTaskService();
   FormService formService = activitiRule.getFormService();

   ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ProcessWithForm");
   assertNotNull(processInstance);

T   ask task = taskService.createTaskQuery().singleResult();
   String taskId = task.getId();

   List<FormProperty> listFormProperties = formService.getTaskFormData(taskId).getFormProperties();
   for (FormProperty formProperty : listFormProperties) {
l      ogger.info(formProperty.getName() + " = " + formProperty.getValue());
   }

   Map<String, String> properties = new HashMap<String, String>();
   properties.put("name", "fegor");
   properties.put("age", "100");
   formService.submitTaskFormData(taskId, properties);

   boolean resAssert = Integer.parseInt(listFormProperties.get(1).getValue()) == Integer.parseInt("18");
   assertTrue(resAssert);

}

Highlighted
Established Member II

Re: How to render a external form?

I'm sorry:

T   ask task = taskService.createTaskQuery().singleResult();

is

Task task = taskService.createTaskQuery().singleResult();

and 

l      ogger.info(formProperty.getName() + " = " + formProperty.getValue());

is

logger.info(formProperty.getName() + " = " + formProperty.getValue());

Smiley Happy

Highlighted
Established Member

Re: How to render a external form?

K. How do you display the fields of user task? 

Highlighted
Established Member II

Re: How to render a external form?

In the before code:

List<FormProperty> listFormProperties = formService.getTaskFormData(taskId).getFormProperties();

taskId is Id of task and return the fields (for...)