流程配置文件设置:
<task-node name="处理任务" create-tasks="false">
<task name="处理任务" url="/workflow/testhq/processtask.jsp">
</task>
<event type="node-enter">
<action name="createTask" class="testhq.CreateTask"></action>
</event>
<transition name="结束" to="结束"></transition>
</task-node>
其中testhq.CreateTask为动态产生任务的处理类
create-tasks="false"表明本节点不由引擎自动创建任务
testhq.CreateTask代码:

package testhq;

import java.util.StringTokenizer;

import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
import org.jbpm.graph.node.TaskNode;
import org.jbpm.taskmgmt.def.Task;
import org.jbpm.taskmgmt.exe.TaskMgmtInstance;

public class CreateTask implements ActionHandler
{

/**
*
*/
private static final long serialVersionUID = 2361178579388204288L;

public void execute(ExecutionContext executionContext) throws Exception
{
Token token = executionContext.getToken();
TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();

TaskNode taskNode = (TaskNode) executionContext.getNode();
Task changeNappy = taskNode.getTask("处理任务");

//取出用户组
StringTokenizer st = new StringTokenizer((String) executionContext.getVariable("actorList"), ",");
while (st.hasMoreTokens())
{
String actorId = st.nextToken();
//给用户actorId创建任务
tmi.createTaskInstance(changeNappy,token).setActorId(actorId);
}


}

}