11-28-2017 08:56 AM
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?
11-28-2017 09:36 AM
11-29-2017 12:50 AM
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?
11-29-2017 03:43 AM
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);
}
11-29-2017 03:44 AM
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());
12-01-2017 04:04 AM
K. How do you display the fields of user task?
12-01-2017 09:13 AM
In the before code:
List<FormProperty> listFormProperties = formService.getTaskFormData(taskId).getFormProperties();
taskId is Id of task and return the fields (for...)
Explore our Alfresco products with the links below. Use labels to filter content by product module.