As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
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?
Hi!
Please, watch: Activiti User Guide
Regards.
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?
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);
}
I'm sorry:
T ask task = taskService.createTaskQuery().singleResult();
is
Task task = taskService.createTaskQuery().singleResult();
and
l ogger.info(formProperty.getName() + " = " + formProperty.getValue());
logger.info(formProperty.getName() + " = " + formProperty.getValue());
K. How do you display the fields of user task?
In the before code:
List<FormProperty> listFormProperties = formService.getTaskFormData(taskId).getFormProperties();
taskId is Id of task and return the fields (for...)