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?
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());
is
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...)
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.