首先时部署请假流程,然后启动流程,代码如下/**
* 开始申请
* @return
*/
public String startApply(){
//部署流程定义
//String proceddDefinitionId = getLeaveService().deployNew();
String deploymentId = getLeaveService().deployZIPNew();
//启动流程定义
String staffName = ((Staff)getHttpSession().getAttribute(Globarle.SYS_CURRENTUSER)).getStaffName();
ProcessDefinition processDefinition = getLeaveService().getPDByDeploymentId(deploymentId);
getLeaveService().startProcessInstanceById(staffName, processDefinition.getId());
return "toTaskList";
}
然后我struts里配置的时redirectAction,即直接跳转到查询用户代办任务的Action方法getTasks,但是经测试,返回的list始终size==0,不知道怎么解决,望高手指点!/**
* 获取当前用户的待办任务
* @return
*/
public String getTasks(){
String assignee = ((Staff)getHttpSession().getAttribute(Globarle.SYS_CURRENTUSER)).getStaffName();
this.getModel().setTaskList(getLeaveService().getTasksList(assignee));
System.out.println("待办任务个数:" + getLeaveService().getTasksList(assignee).size());
getRequest().setAttribute("taskList", this.getModel().getTaskList());
return "taskList";
}jsp页面遍历显示待办任务的相关代码:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basepath",basePath);
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>待办任务列表页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
#taskcaption{
width:700px;
height:200px;
position:absolute;
left:50%;
margin-left:-350px;
margin-top:15px;
text-align:center;
border:1px #999999 solid;
}
table{
border-collapse:collapse;
}
</style> </head>
<body>
<div id="taskcaption">
<table border="1" width="100%" cellpadding="3" cellspacing="1">
<caption><strong>待办任务</strong></caption>
<thead>
<tr style="text-align:center;font-weight:400;">
<td>任务ID</td>
<td>任务名称</td>
<td>任务处理人</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<s:if test="#request.taskList.size == 0">
<tr>
<td colspan="4">
<span style="width:100%;font-size:16px;font-weight:800;text-align:center;color:#ff0000;">
您暂无待办任务
</span>
</td>
</tr>
</s:if>
<s:else>
<s:iterator var="task" value="#request.taskList">
<tr>
<td>${task.id}</td>
<td>${task.name}</td>
<td>${task.assignee}</td>
<td><a href="${basepath}${task.formResourceName}?taskId=${task.id}">处理</a></td>
</tr>
</s:iterator>
</s:else>
</tbody>
</table>
</div>
</body>
</html>
* 开始申请
* @return
*/
public String startApply(){
//部署流程定义
//String proceddDefinitionId = getLeaveService().deployNew();
String deploymentId = getLeaveService().deployZIPNew();
//启动流程定义
String staffName = ((Staff)getHttpSession().getAttribute(Globarle.SYS_CURRENTUSER)).getStaffName();
ProcessDefinition processDefinition = getLeaveService().getPDByDeploymentId(deploymentId);
getLeaveService().startProcessInstanceById(staffName, processDefinition.getId());
return "toTaskList";
}
然后我struts里配置的时redirectAction,即直接跳转到查询用户代办任务的Action方法getTasks,但是经测试,返回的list始终size==0,不知道怎么解决,望高手指点!/**
* 获取当前用户的待办任务
* @return
*/
public String getTasks(){
String assignee = ((Staff)getHttpSession().getAttribute(Globarle.SYS_CURRENTUSER)).getStaffName();
this.getModel().setTaskList(getLeaveService().getTasksList(assignee));
System.out.println("待办任务个数:" + getLeaveService().getTasksList(assignee).size());
getRequest().setAttribute("taskList", this.getModel().getTaskList());
return "taskList";
}jsp页面遍历显示待办任务的相关代码:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basepath",basePath);
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>待办任务列表页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
#taskcaption{
width:700px;
height:200px;
position:absolute;
left:50%;
margin-left:-350px;
margin-top:15px;
text-align:center;
border:1px #999999 solid;
}
table{
border-collapse:collapse;
}
</style> </head>
<body>
<div id="taskcaption">
<table border="1" width="100%" cellpadding="3" cellspacing="1">
<caption><strong>待办任务</strong></caption>
<thead>
<tr style="text-align:center;font-weight:400;">
<td>任务ID</td>
<td>任务名称</td>
<td>任务处理人</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<s:if test="#request.taskList.size == 0">
<tr>
<td colspan="4">
<span style="width:100%;font-size:16px;font-weight:800;text-align:center;color:#ff0000;">
您暂无待办任务
</span>
</td>
</tr>
</s:if>
<s:else>
<s:iterator var="task" value="#request.taskList">
<tr>
<td>${task.id}</td>
<td>${task.name}</td>
<td>${task.assignee}</td>
<td><a href="${basepath}${task.formResourceName}?taskId=${task.id}">处理</a></td>
</tr>
</s:iterator>
</s:else>
</tbody>
</table>
</div>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货