Miracle2.1 列表页面显示附件链接
private IFileManager fileManager;/*所有的MtCommon都用自己实体替换;*/@Overrideprotected List<MtCommon> listEntity(QueryWhereDTO where, QuerySortDTO sort,int firstRowNo, int rowsPerpage) {//monitor 替换为自己的项目名称String downUrl = "<a href='/monitor/framework/fileupload/FileUpload.do?method=download&fileId=";List<MtCommon> list = super.listEntity(where, sort, firstRowNo, rowsPerpage);for(MtCommon mt:list){//mt.getMtId();获取主键id;String entityId = mt.getMtId();String fileId = fileManager.getFileIdByEntityId(entityId);if(!"".equals(fileId.trim())){String url = downUrl;//name为列表页面要显示的列url +=fileId+"'>"+mt.getName()+"</a>";mt.setName(url);}}return list;}public IFileManager getFileManager() {return fileManager;}public void setFileManager(IFileManager fileManager) {this.fileManager = fileManager;}
?
2. action 对应的bean配置文件,中添加IFileManager? 的注入
<property name="fileManager" ref="fileManager" />
?
?