How to connect jsp with activiti workflow

818 views Asked by At

I am new at activiti. I need to display a jsp page from the activiti workflow. How can i do that. I tried with adding

<userTask id="usertask1" name="User Task" activiti:formKey="C:\Users\au829112\Documents\Userdata\HRSystem\src\main\webapp\WEB-INF\views\flow.jsp"></userTask>

But not working at all.Anyone please help.

2

There are 2 answers

0
Greg Harley On

I am assuming you are using the default form engine (JuelFormEngine), if you haven't explicitly configured something else, then this is what you are using.

This being the case, then the formkey path should reference a file in your deployment bar file rather than a path on your filesystem. Note the following code from the JuelFormEngine class to retrieve the form template:

 protected String getFormTemplateString(FormData formInstance, String formKey) {
    String deploymentId = formInstance.getDeploymentId();

    ResourceEntity resourceStream = Context
      .getCommandContext()
      .getResourceEntityManager()
      .findResourceByDeploymentIdAndResourceName(deploymentId, formKey);

Notice how it pulls a resource from the deployment. So, in order to use the form key, you will need to create a .bar file (a simple zip file) and add the process model as well as any referenced form jsp's into the zip file. Then deploy it to the Activiti engine.

Please note that Activiti is extremely flexible and the way the form key is handled will depend entirely on the form engine you are using.

Hope this helps.

1
Ben On

You can do that with the formKey-Attribute. Take a look at this post here: Activiti workflow and Orbeon XForm Integration

It describes an approach for integrating XForms into Activiti but this also works for JSP-Pages.

In addition, the user guide can help you concerning the formKey-Attribute: http://www.activiti.org/userguide/#externalFormRendering

Several posts in the Activiti forums deal with this topic as well: http://forums.activiti.org/content/using-jsp-instead-forms