Extjs4 img使用

本设计后台采用ssh,前台采用Extjs4 ,因为项目需要图片且图片显示采用字节流InputStream。

后台代码:

@Action(value = "read",results = { @Result(name = "success", type = "stream") })
public String loadByDeployment() throws Exception {
     ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
     String resourceName = "";
     if (resourceType.equals("image")) {
                  resourceName = processDefinition.getDiagramResourceName();
     } else if (resourceType.equals("xml")) {
                 resourceName = processDefinition.getResourceName();
     }
     InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
     this.setInputStream(resourceAsStream);
     return SUCCESS;
}

使用的是Struts注解方式,用stream类型的Result实现Ajax,对应的是InputStream字节流形式。

前台代码:

      var changingImage = Ext.create(‘Ext.Img‘, {
          src: approot + ‘/ActivitiAct/read.action?resourceType=image&processDefinitionId=‘+record.data.id+‘‘,
          renderTo: Ext.getBody()
       });

       Ext.create(‘Ext.window.Window‘, {
           title: ‘流程图‘,
           height:480,
           closable :true,
           autoScroll:true,
           layout: ‘fit‘,
           items: changingImage
      }).show();

效果图:Extjs4 img使用

Extjs4 img使用,布布扣,bubuko.com

Extjs4 img使用

上一篇:CSS 子节点选择器


下一篇:ADO.NET