我想追踪一个流程实例的过程,显示流程图,可是图片总是不显示 <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%> <%@ page import="java.util.*, org.jbpm.api.*, org.jbpm.api.model.*" %> <% String path = request.getContextPath(); %> <% String processInstanceId = request.getParameter("id"); ProcessEngine processEngine = Configuration.getProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); ExecutionService executionService = processEngine.getExecutionService(); ProcessInstance processInstance = executionService.findProcessInstanceById(processInstanceId); Set<String> activeNames = processInstance.findActiveActivityNames(); ActivityCoordinates ac = repositoryService.getActivityCoordinates(processInstance.getProcessDefinitionId(), activeNames.iterator().next()); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP ""view.jsp"" starting page</title> </head> <body> <img src="<%=path %>/jbpm/jbpm_drawImage?id=<%=processInstanceId %>" style="position:absolute; left: 0px; top: 0px;"/> <div style="position:absolute; border:1px solid #cc0000; left:<%=ac.getX() %>px; top: <%=ac.getY() %>px; width: <%=ac.getWidth() %>px; height: <%=ac.getHeight() %>px;"></div> </body> </html> 下面代码是上面img获取图片的struts2代码 public String drawImage() throws IOException { String processInstanceId = request.getParameter("id"); ProcessEngine processEngine = Configuration.getProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); ExecutionService executionService = processEngine.getExecutionService(); ProcessInstance processInstance = executionService.findProcessInstanceById(processInstanceId); String processDefinitionId = processInstance.getProcessDefinitionId(); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionId(processDefinitionId) .uniqueResult(); InputStream inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getImageResourceName()); System.err.println(processDefinition.getImageResourceName()); //输出结果为leave.png,是正确的 byte[] b = new byte[1024*4]; int len = -1; while((len = inputStream.read(b, 0, 1024*4)) != -1) { System.err.println(len);//输出结果为2518,说明有读取到数据 response.getOutputStream().write(b, 0, len); } return null; } 当页面转到上面要显示图片的jsp时,显示的小红叉 |
|
没人回答吗,急啊,我谷歌查,看到的方式跟我的一样啊,为什么我的就显示不出来呢
|
|
37分 |
你发布流程图了吗?
后台报社么错啊? 参考我们的视频教程: 照着视频肯定可以做出来,只要你够细心。 |
另外,有jbpm4的问题,可以直接来我们的论坛版块:
http://old.family168.com/bbs/index.asp?boardid=6 |
|
后台没报错
代码一样啊,我就是根据视频教程写出的代码,只不过先把代码全部放在struts2里面而已 如果我像视频教程那样,写在jsp里面,我运行时后台会报错:getOutputStream() has already bean called for this response |
|
错误信息都有了,你就不会去google上搜一下?
http://guoyiqi.javaeye.com/blog/75929 怎么这么懒啊? |
|
我搜了,你给我的那个网址早就搜到了,加上那两句是没报错,但是照样不显示图片啊,所以我才将显示图片的方法放在struts2的action里
|
|
但放在action里,效果跟加上那两句的效果一样,没报错,但图片不显示
|
|
13分 |
兰州烧饼什么意思?
|
好像没惹你吧 |
|
那就不知道了。因为我们的视频里是好好的哟,希望你尽快找到错误的原因吧。
|
|
upup
|