1 <dl>
2 <dt><hi:text key="照片" entity="Resume"/>:</dt>
3 <dd>
4 <input type="hidden" name="resume.photo_attachment.id" value="${resume.photo_attachment.id}"/>
5 <input type="text" class="textInput" name="resume.hi_photo_attachment.fileName" value="${resume.photo_attachment.fileName}" readonly="readonly"/>
6 <a class="btnAttach" href="<hi:url>attachmentLookup.action?lookup=1&from=attachment&saveType=1</hi:url>" lookupGroup="resume" lookupName="photo_attachment" width="560" height="300" title="<hi:text key="附件"/>"><hi:text key="附件"/></a>
7 <c:if test="${not empty resume.photo_attachment}">
8 <a class="btnView" href="attachmentView.action?attachment.id=${resume.photo_attachment.id}" target="_blank">
9 <hi:text key="查看"/>
10 </a>
11 </c:if>
12 </dd>
13 </dl>
2 <dt><hi:text key="照片" entity="Resume"/>:</dt>
3 <dd>
4 <input type="hidden" name="resume.photo_attachment.id" value="${resume.photo_attachment.id}"/>
5 <input type="text" class="textInput" name="resume.hi_photo_attachment.fileName" value="${resume.photo_attachment.fileName}" readonly="readonly"/>
6 <a class="btnAttach" href="<hi:url>attachmentLookup.action?lookup=1&from=attachment&saveType=1</hi:url>" lookupGroup="resume" lookupName="photo_attachment" width="560" height="300" title="<hi:text key="附件"/>"><hi:text key="附件"/></a>
7 <c:if test="${not empty resume.photo_attachment}">
8 <a class="btnView" href="attachmentView.action?attachment.id=${resume.photo_attachment.id}" target="_blank">
9 <hi:text key="查看"/>
10 </a>
11 </c:if>
12 </dd>
13 </dl>
1 <%@ page language="java" contentType="text/html; charset=utf-8"%>
2 <%@ include file="/includes/main.jsp"%>
3
4 <%
5 String attachDesc = request.getParameter("from");
6 if (attachDesc == null )
7 attachDesc = "attachment";
8 String attachmentType= request.getParameter("saveType");
9 if (attachmentType== null )
10 attachmentType ="1";
11 %>
12
13 <h2 class="contentTitle">请选择需要上传的附件</h2>
14 <form name="saveForm" action="attachmentSave.action?ajax=0" method="post" enctype="multipart/form-data" class="pageForm required-validate" onsubmit="return iframeCallback(this, $.bringBack)">
15
16
17 <input type="hidden" name="attachment.attachDesc" value="<%=attachDesc%>" />
18 <input type="hidden" name="attachment.attachmentType" value="<%=attachmentType%>" />
19 <input type="hidden" name="attachment.id" value="${attachment.id}"/>
20 <input type="hidden" name="attachment.version" value="${attachment.version}"/>
21
22 <div class="pageContent">
23 <div class="pageFormContent" layoutH="97">
24 <dl>
25 <dt>附件:</dt><dd><input type="file" name="image" class="required" size="30" /></dd>
26 </dl>
27 </div>
28 <div class="formBar">
29 <ul>
30 <li><div class="buttonActive"><div class="buttonContent"><button type="submit">上传</button></div></div></li>
31 <li><div class="button"><div class="buttonContent"><button type="button" onclick="javascript:$.bringBack({id:'-1', fileName:'', attachmentPath:'',attachmentSize:'',imageICO:''})"><hi:text key="重置"/></button></div></div></li>
32 </ul>
33 </div>
34 </div>
35 </form>
36
2 <%@ include file="/includes/main.jsp"%>
3
4 <%
5 String attachDesc = request.getParameter("from");
6 if (attachDesc == null )
7 attachDesc = "attachment";
8 String attachmentType= request.getParameter("saveType");
9 if (attachmentType== null )
10 attachmentType ="1";
11 %>
12
13 <h2 class="contentTitle">请选择需要上传的附件</h2>
14 <form name="saveForm" action="attachmentSave.action?ajax=0" method="post" enctype="multipart/form-data" class="pageForm required-validate" onsubmit="return iframeCallback(this, $.bringBack)">
15
16
17 <input type="hidden" name="attachment.attachDesc" value="<%=attachDesc%>" />
18 <input type="hidden" name="attachment.attachmentType" value="<%=attachmentType%>" />
19 <input type="hidden" name="attachment.id" value="${attachment.id}"/>
20 <input type="hidden" name="attachment.version" value="${attachment.version}"/>
21
22 <div class="pageContent">
23 <div class="pageFormContent" layoutH="97">
24 <dl>
25 <dt>附件:</dt><dd><input type="file" name="image" class="required" size="30" /></dd>
26 </dl>
27 </div>
28 <div class="formBar">
29 <ul>
30 <li><div class="buttonActive"><div class="buttonContent"><button type="submit">上传</button></div></div></li>
31 <li><div class="button"><div class="buttonContent"><button type="button" onclick="javascript:$.bringBack({id:'-1', fileName:'', attachmentPath:'',attachmentSize:'',imageICO:''})"><hi:text key="重置"/></button></div></div></li>
32 </ul>
33 </div>
34 </div>
35 </form>
36
1 package org.hi.common.attachment.action.struts;
2
3 import java.io.File;
4 import java.util.List;
5
6 import org.hi.SpringContextHolder;
7 import org.hi.framework.HiConfigHolder;
8 import org.hi.framework.paging.PageInfo;
9 import org.hi.framework.web.BusinessException;
10 import org.hi.framework.web.PageInfoUtil;
11 import org.hi.framework.web.struts.BaseAction;
12 import org.hi.i18n.util.I18NUtil;
13
14 import org.hi.common.attachment.action.AttachmentPageInfo;
15 import org.hi.common.attachment.action.cust.FtpUtil;
16 import org.hi.common.attachment.model.Attachment;
17 import org.hi.common.attachment.service.AttachmentManager;
18
19 public class AttachmentAction extends BaseAction{
20
21 private Attachment attachment;
22 private AttachmentPageInfo pageInfo;
23 private List<Attachment> attachments;
24 private String orderIndexs;
25
26 private File image;
27 private String imageFileName;
28 /**
29 * 上传文件的文件类型
30 */
31 private String imageContentType;
32
33 /**
34 * 设置上传文件的大小
35 */
36 private String maxSize= HiConfigHolder.getProperty("hi.upload.ftp.maxSize") == null ? "100" : HiConfigHolder.getProperty("hi.upload.ftp.maxSize");
37 /**
38 * 新增/修改保存附件
39 */
40 public String saveAttachment() throws Exception {
41 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
42 if(super.perExecute(attachment)!= null) return returnCommand();
43
44 if (image != null) {
45 if (image.length()/1024d/1024d > new Double(maxSize))
46 throw new BusinessException(I18NUtil.getStringByParameter("上传文件过大", "Attachment", maxSize));
47
48 String imagePath = "";
49 if (attachment.getAttachmentType() == 2)
50 imagePath = FtpUtil.getFtpUploadClient().saveFileToFTP(image, imageFileName,attachment.getAttachDesc());
51 else
52 imagePath = FtpUtil.getOSFileClient().saveFile(image, imageFileName,attachment.getAttachDesc());
53
54 attachment.setAttachmentPath(imagePath);
55 attachment.setFileSize( image.length()/1024d );
56 attachment.setFileType(imageContentType);
57 attachment.setFileName(imageFileName);
58 attachmentMgr.saveObject(attachment);
59 }
60
61
62 super.postExecute(attachment);
63 return returnCommand();
64 }
65
66
67 /**
68 * 删除附件
69 */
70 public String removeAttachment() throws Exception {
71 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
72 attachmentMgr.removeAttachmentById(attachment.getId());
73 return returnCommand();
74 }
75
76 /**
77 * 删除指定的某些附件
78 */
79 public String removeAllAttachment() throws Exception {
80 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
81 if (orderIndexs != null && orderIndexs.length()> 0 )
82 {
83 String[] ids= orderIndexs.split(",");
84 for( int i=0; i<ids.length; i++)
85 {
86 if (ids[i].length()>0)
87 {
88 Integer attachmentid = new Integer( ids[i] );
89 attachmentMgr.removeAttachmentById(attachmentid);
90 }
91 }
92 }
93
94 return returnCommand();
95 }
96
97 /**
98 *查看附件
99 */
100 public String viewAttachment() throws Exception {
101 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
102 attachment = attachmentMgr.getAttachmentById(attachment.getId());
103 return returnCommand();
104 }
105
106 /**
107 * 附件列表
108 */
109 public String attachmentList() throws Exception {
110 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
111 pageInfo = pageInfo == null ? new AttachmentPageInfo() : pageInfo;
112 PageInfo sarchPageInfo = PageInfoUtil.populate(pageInfo, this);
113
114 attachments = attachmentMgr.getAttachmentList(sarchPageInfo);
115
116 return returnCommand();
117 }
118
119
120
121
122 public Attachment getAttachment() {
123 return attachment;
124 }
125
126 public void setAttachment(Attachment attachment) {
127 this.attachment = attachment;
128 }
129
130 public List<Attachment> getAttachments() {
131 return attachments;
132 }
133
134 public void setAttachments(List<Attachment> attachments) {
135 this.attachments = attachments;
136 }
137
138 public AttachmentPageInfo getPageInfo() {
139 return pageInfo;
140 }
141
142 public void setPageInfo(AttachmentPageInfo pageInfo) {
143 this.pageInfo = pageInfo;
144 }
145
146 public String getOrderIndexs() {
147 return orderIndexs;
148 }
149
150 public void setOrderIndexs(String orderIndexs) {
151 this.orderIndexs = orderIndexs;
152 }
153
154
155 public File getImage() {
156 return image;
157 }
158
159
160 public void setImage(File image) {
161 this.image = image;
162 }
163
164
165 public String getImageFileName() {
166 return imageFileName;
167 }
168
169
170 public void setImageFileName(String imageFileName) {
171 this.imageFileName = imageFileName;
172 }
173
174
175 public String getImageContentType() {
176 return imageContentType;
177 }
178
179
180 public void setImageContentType(String imageContentType) {
181 this.imageContentType = imageContentType;
182 }
183
184
185 public String getMaxSize() {
186 return maxSize;
187 }
188
189
190 public void setMaxSize(String maxSize) {
191 this.maxSize = maxSize;
192 }
193
194
195
196 }
197
2
3 import java.io.File;
4 import java.util.List;
5
6 import org.hi.SpringContextHolder;
7 import org.hi.framework.HiConfigHolder;
8 import org.hi.framework.paging.PageInfo;
9 import org.hi.framework.web.BusinessException;
10 import org.hi.framework.web.PageInfoUtil;
11 import org.hi.framework.web.struts.BaseAction;
12 import org.hi.i18n.util.I18NUtil;
13
14 import org.hi.common.attachment.action.AttachmentPageInfo;
15 import org.hi.common.attachment.action.cust.FtpUtil;
16 import org.hi.common.attachment.model.Attachment;
17 import org.hi.common.attachment.service.AttachmentManager;
18
19 public class AttachmentAction extends BaseAction{
20
21 private Attachment attachment;
22 private AttachmentPageInfo pageInfo;
23 private List<Attachment> attachments;
24 private String orderIndexs;
25
26 private File image;
27 private String imageFileName;
28 /**
29 * 上传文件的文件类型
30 */
31 private String imageContentType;
32
33 /**
34 * 设置上传文件的大小
35 */
36 private String maxSize= HiConfigHolder.getProperty("hi.upload.ftp.maxSize") == null ? "100" : HiConfigHolder.getProperty("hi.upload.ftp.maxSize");
37 /**
38 * 新增/修改保存附件
39 */
40 public String saveAttachment() throws Exception {
41 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
42 if(super.perExecute(attachment)!= null) return returnCommand();
43
44 if (image != null) {
45 if (image.length()/1024d/1024d > new Double(maxSize))
46 throw new BusinessException(I18NUtil.getStringByParameter("上传文件过大", "Attachment", maxSize));
47
48 String imagePath = "";
49 if (attachment.getAttachmentType() == 2)
50 imagePath = FtpUtil.getFtpUploadClient().saveFileToFTP(image, imageFileName,attachment.getAttachDesc());
51 else
52 imagePath = FtpUtil.getOSFileClient().saveFile(image, imageFileName,attachment.getAttachDesc());
53
54 attachment.setAttachmentPath(imagePath);
55 attachment.setFileSize( image.length()/1024d );
56 attachment.setFileType(imageContentType);
57 attachment.setFileName(imageFileName);
58 attachmentMgr.saveObject(attachment);
59 }
60
61
62 super.postExecute(attachment);
63 return returnCommand();
64 }
65
66
67 /**
68 * 删除附件
69 */
70 public String removeAttachment() throws Exception {
71 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
72 attachmentMgr.removeAttachmentById(attachment.getId());
73 return returnCommand();
74 }
75
76 /**
77 * 删除指定的某些附件
78 */
79 public String removeAllAttachment() throws Exception {
80 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
81 if (orderIndexs != null && orderIndexs.length()> 0 )
82 {
83 String[] ids= orderIndexs.split(",");
84 for( int i=0; i<ids.length; i++)
85 {
86 if (ids[i].length()>0)
87 {
88 Integer attachmentid = new Integer( ids[i] );
89 attachmentMgr.removeAttachmentById(attachmentid);
90 }
91 }
92 }
93
94 return returnCommand();
95 }
96
97 /**
98 *查看附件
99 */
100 public String viewAttachment() throws Exception {
101 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
102 attachment = attachmentMgr.getAttachmentById(attachment.getId());
103 return returnCommand();
104 }
105
106 /**
107 * 附件列表
108 */
109 public String attachmentList() throws Exception {
110 AttachmentManager attachmentMgr = (AttachmentManager)SpringContextHolder.getBean(Attachment.class);
111 pageInfo = pageInfo == null ? new AttachmentPageInfo() : pageInfo;
112 PageInfo sarchPageInfo = PageInfoUtil.populate(pageInfo, this);
113
114 attachments = attachmentMgr.getAttachmentList(sarchPageInfo);
115
116 return returnCommand();
117 }
118
119
120
121
122 public Attachment getAttachment() {
123 return attachment;
124 }
125
126 public void setAttachment(Attachment attachment) {
127 this.attachment = attachment;
128 }
129
130 public List<Attachment> getAttachments() {
131 return attachments;
132 }
133
134 public void setAttachments(List<Attachment> attachments) {
135 this.attachments = attachments;
136 }
137
138 public AttachmentPageInfo getPageInfo() {
139 return pageInfo;
140 }
141
142 public void setPageInfo(AttachmentPageInfo pageInfo) {
143 this.pageInfo = pageInfo;
144 }
145
146 public String getOrderIndexs() {
147 return orderIndexs;
148 }
149
150 public void setOrderIndexs(String orderIndexs) {
151 this.orderIndexs = orderIndexs;
152 }
153
154
155 public File getImage() {
156 return image;
157 }
158
159
160 public void setImage(File image) {
161 this.image = image;
162 }
163
164
165 public String getImageFileName() {
166 return imageFileName;
167 }
168
169
170 public void setImageFileName(String imageFileName) {
171 this.imageFileName = imageFileName;
172 }
173
174
175 public String getImageContentType() {
176 return imageContentType;
177 }
178
179
180 public void setImageContentType(String imageContentType) {
181 this.imageContentType = imageContentType;
182 }
183
184
185 public String getMaxSize() {
186 return maxSize;
187 }
188
189
190 public void setMaxSize(String maxSize) {
191 this.maxSize = maxSize;
192 }
193
194
195
196 }
197
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE struts PUBLIC
3 "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
4 "http://struts.apache.org/dtds/struts-2.0.dtd">
5 <struts>
6 <package name="attachment" extends="hi" >
7 <!-- ============= 附件对应的AttachmentAction============ -->
8
9
10 <action name="attachmentSave"
11 class="org.hi.common.attachment.action.struts.AttachmentAction" method="saveAttachment">
12 <result name="success" >/attachment/AttachmentBrightBack.jsp</result>
13 <interceptor-ref name="modelStackUpload" />
14 </action>
15
16 <action name="attachmentView"
17 class="org.hi.common.attachment.action.struts.AttachmentViewAction">
18 <result name="success" type="stream">
19 <param name="inputName">inputStream</param>
20 <param name="contentType">${contentType}</param>
21 <param name="contentDisposition">filename="${fileName}"</param>
22 </result>
23 <interceptor-ref name="modelParamsStack" />
24 </action>
25
26
27 <action name="attachmentLookup"
28 class="org.hi.common.attachment.action.struts.AttachmentAction" method="attachmentList">
29 <result name="success">/attachment/AttachmentList.jsp</result>
30 <interceptor-ref name="modelParamsStack" />
31 </action>
32
33 </package>
34 </struts>
2 <!DOCTYPE struts PUBLIC
3 "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
4 "http://struts.apache.org/dtds/struts-2.0.dtd">
5 <struts>
6 <package name="attachment" extends="hi" >
7 <!-- ============= 附件对应的AttachmentAction============ -->
8
9
10 <action name="attachmentSave"
11 class="org.hi.common.attachment.action.struts.AttachmentAction" method="saveAttachment">
12 <result name="success" >/attachment/AttachmentBrightBack.jsp</result>
13 <interceptor-ref name="modelStackUpload" />
14 </action>
15
16 <action name="attachmentView"
17 class="org.hi.common.attachment.action.struts.AttachmentViewAction">
18 <result name="success" type="stream">
19 <param name="inputName">inputStream</param>
20 <param name="contentType">${contentType}</param>
21 <param name="contentDisposition">filename="${fileName}"</param>
22 </result>
23 <interceptor-ref name="modelParamsStack" />
24 </action>
25
26
27 <action name="attachmentLookup"
28 class="org.hi.common.attachment.action.struts.AttachmentAction" method="attachmentList">
29 <result name="success">/attachment/AttachmentList.jsp</result>
30 <interceptor-ref name="modelParamsStack" />
31 </action>
32
33 </package>
34 </struts>
相关推荐
标题中的“j-ui dwz 好文件”很可能是指基于Java开发的一款名为“j-ui”的用户界面框架,其中“dwz”可能是该框架的一个特定版本或者一个子项目名称。DWZ全称可能为“Design Without Z-index”,它可能是一个专为...
离线安装包,亲测可用
dwz与spring集成的例子 DWZ Java (MyBiaits+SpringMVC) 示例 ...mysql -u root -p dwz4j < dwz4j.sql 2) JDK 1.6 3) 项目文件UTF-8编码,如果用eclipse打开项目,注意把工作空间编码设成UTF-8 4) 启动tomcat
6. **对话框与弹窗**:DWZ提供了多种类型的对话框,如提示框、确认框、信息框、加载框,以及可自定义的弹窗,这些对话框都支持Ajax加载内容,增强了用户体验。 7. **表单处理**:框架内置了表单验证和提交功能,...
离线安装包,亲测可用
【标题】"dwz-demo-1.1.6RC1.zip_DEMO_dwz php_dwz-demo_dwz-ria_php dwz" 指的是一个基于PHP的开源前端框架dwz的演示版本,版本号为1.1.6RC1。这个压缩包包含了一个名为“dwz-demo”的项目,是用于展示和学习dwz...
【标题】"dwz4j-demo-" 指的是一个基于DWZ Java框架的演示项目,这通常是为了展示DWZ框架的功能和用法而创建的一个实例应用。DWZ(Dynamic Web Zone)是一个开源的Java Web开发框架,它专注于提供前端UI和后端服务的...
dwz4j不仅仅是一个开发框架,还包括了一套完整的UI规范(包括前台UI规范和后台管理DWZ UI框架)、程序框架、开发流程、测试流程、版本控制、数据备份方案 dwz4j帮助开发人员搞定所有低级的基础代码——所有那些需要...
DWZ框架dwz4j-springmvc dwz-ria-1.4.4 dwz-user-guide.swf DWZ框架使用的实例简单介绍.doc DWZ框架使用手册.pdf
"dwz4j-demo-20111025.zip"可能是一个具体的演示项目,包含了2011年10月25日时的DWZ框架的使用示例,帮助开发者了解如何在实际项目中应用DWZ框架。 在使用"dwz4j-springmvc.zip"进行开发时,开发者可以期待以下关键...
"dwz" 是框架的简称,"dwz_demo" 和 "dwz-demo" 可能指的是框架的演示或示例代码,"dwz-ria" 强调了其与RIA的关联,而 "ria" 是Rich Internet Application的缩写,代表了这种类型的软件应用。 **压缩包子文件:** ...
j-ui原(DWZ富客户端框架),设计目标: 简单实用、扩展灵活、开发快速、RIA思路、轻量级;以HTML扩展的方式代替JavaScript代码,几乎可以达到用户不懂JavaScript也能很容易学会的使用,支持各种页面组件及Ajax相关...
【标题】"dwzteam-dwz_jui-master" 是一个开源项目,主要涉及的是DWZ UI框架的一个版本。DWZ UI(Dynamic Web Zone User Interface)是一个基于jQuery的前端交互框架,专为Web应用程序设计,提供了丰富的组件和交互...
### DWZ富客户端框架概述 DWZ是一款专为中国开发者打造的富客户端框架,它基于jQuery实现了RIA(Rich Internet Applications)的开发模式。该框架的主要设计理念是简单实用、易于扩展、加速开发过程,并遵循轻量级...
mysql -u root -p dwz4j < dwz4j.sql 2) JDK 1.6 3) 项目文件UTF-8编码,如果用eclipse打开项目,注意把工作空间编码设成UTF-8 4) 启动tomcat 功能演示: Ajax Search 分页 添加 删除 修改 导出Excel ...
J-HI(Java Web)快速开发平台 + jUI整合应用(Eclipse插件生成项目代码) ThinkPHP2.1 + jUI整合应用 YII + jUI整合应用 常见问题及解决: Error loading XML document: dwz.frag.xml 直接用IE打开index.html弹出一个...
【DWZ团队-DWZ_group-master】项目是一个基于DWZ框架和ThinkPHP开发的小组工作日志管理系统。这个系统的设计目标是提供一个简洁高效的工具,用于团队成员记录、分享和管理日常工作进度,促进团队协作与沟通。下面...
DWZ系列开源项目: dwz富客户端框架 - jUI dwz4j(Java Web)快速开发框架 + jUI整合应用 J-HI(Java Web)快速开发平台 + jUI整合应用(Eclipse插件生成项目代码) ThinkPHP2.1 + jUI整合应用 YII + jUI整合应用
DWZ富客户端框架dwz-ria-1.4.6是一款专为开发高效、美观的Web应用程序而设计的后台框架。这款框架集成了多种技术,旨在简化开发过程,让开发者无需深入理解AJAX和jQuery等复杂技术,也能快速构建出与专业级应用相...
### DWZ富客户端框架:深度解析与应用指南 #### 概述 DWZ富客户端框架,作为一款由国人自主研发的RIA(Rich Internet Application)框架,其核心构建在jQuery基础上,旨在提供一种简单实用、易于扩展且能快速进行...