JBPM工作流引擎----查看流程图(非文件下载)

Struts2中,如果不需要保存文件,只为了图片显示,图片不需要下载,获取到文件流就可以了。

Struts.xml配置如下:

<result name="downloadProcessImage" type="stream">
    <param name="inputName">inputStream</param>
    <!-- name属性的值固定,为inputName,值inputStream与Javabean对应 -->
</result>

JBPM获取流的代码:

action:

public String downloadProcessImage(){
		InputStream inputStream  = elecProcessDefinitionService.downloadProcessImageById(elecProcessDefinition);//elecProcessDefinition是根据模型驱动获取到的对象。
		elecProcessDefinition.setInputStream(inputStream);
		return "downloadProcessImage";
	}

获取到流之后,只需要再把对象放入到栈顶即可。

service:

public InputStream downloadProcessImageById(
			ElecProcessDefinition elecProcessDefinition) {
		String id = elecProcessDefinition.getId();
		try {
			id = new String(id.getBytes("gbk"),"UTF-8");//对从客户端获取到的中文进行转码
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		ProcessDefinition processDefinition = processEngine
				.getRepositoryService().createProcessDefinitionQuery()
				.processDefinitionId(id).uniqueResult();
		String deploymentId = processDefinition.getDeploymentId();
		String resourceName = processDefinition.getImageResourceName();
		InputStream inputStream = processEngine.getRepositoryService().getResourceAsStream(deploymentId, resourceName);
		return inputStream;
	}

jsp:

<a href="#" οnclick="openWindow('${pageContext.request.contextPath }/system/elecProcessDefinitionAction_downloadProcessImage.action?id=<s:property value="%{#pd.id}"/>','700','400');">


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值