- 浏览: 1572689 次
- 来自: 上海
文章分类
- 全部博客 (374)
- Java (101)
- Struts (54)
- Oracle (30)
- JavaScript (16)
- Spring (27)
- Hibernate (16)
- MyEclipse (3)
- JSF (1)
- FreeMarker (2)
- SiteMesh (2)
- JfreeChart (2)
- Ibatis (2)
- JSP (12)
- MyBatis (4)
- SWFupload (1)
- EJB (4)
- Jboss (4)
- WebService (2)
- Linux (16)
- Android (2)
- XML (6)
- Java 网络编程 (13)
- AXIS2 (1)
- FTP (1)
- Jswing (1)
- Socket (3)
- 杂文选集 (6)
- solr (2)
- PS (1)
- Tomcat (7)
- JDBC (9)
- Highcharts (1)
- maven (1)
- Nodejs (0)
- navicat (2)
- Exception (5)
- eclipse (3)
- jQuery (1)
- springMVC (4)
- MySQL (11)
- SVN (1)
- Sql Server (1)
- zookeeper (1)
- JVM (1)
- Groovy (2)
- Git (1)
- Nginx (1)
- DynamicReport (1)
- IDEA (2)
- JasperReports (1)
- Postgresql (2)
- Mac (1)
- gradle (1)
- 数据结构算法 (1)
最新评论
-
hpu145:
引用引用
java 千分位的添加和去除 -
被遗忘的下路:
少了个junit-4.8.2的包
SSH2整合完整案例(四十三) -
白天看黑夜:
java过滤emoji字符处理,希望能帮到你http://ww ...
emoji 表情图片解决方法 -
caipeiming:
这个挺好JavaScript实现input输入框控件只允许输入 ...
js 控制文本框只能输入中文、英文、数字等 -
双子树:
东西太好啦受教啊
Struts2 JSP中将list,set ,Map传递到Action然后<s:iterator>遍历(三十五)
本文介绍了:
1.基于表单的文件上传
2.Struts 2 的文件下载
3.Struts2.文件上传
4.使用FileInputStream FileOutputStream文件流来上传
5.使用FileUtil上传
6.使用IOUtil上传
7.使用IOUtil上传
8.使用数组上传多个文件
9.使用List上传多个文件
----1.基于表单的文件上传-----
fileupload.jsp
showFile.jsp
----2.手动上传-----
----3 Struts2.文件上传----
案例:使用FileInputStream FileOutputStream文件流来上传
action.java
struts.xml
up.jsp
success.jsp
案例:使用FileUtil上传
action.java
struts.xml
fileutilupload.jsp
fuuSuccess.jsp
案例:使用IOUtil上传
action.java
struts.xml
ioutilupload.jsp
iuuSuccess.jsp
案例:删除服务器上的文件
案例:使用数组上传多个文件
action.java
struts.xml
arrayUpload.jsp
arraySuccess.jsp
案例:使用List上传多个文件
action.java
strust.xml
listUpload.jsp
listSuccess.jsp
案例:Struts2 文件下载
简单文件下载 不含中文附件名
Struts.xml
down.jsp
在ie下 可以看到会打开一个 文件下载对话框 有 打开 保存 取消 按钮
google中 没有了
文件下载,支持中文附件名
action
struts.xml
down1.jsp
1.基于表单的文件上传
2.Struts 2 的文件下载
3.Struts2.文件上传
4.使用FileInputStream FileOutputStream文件流来上传
5.使用FileUtil上传
6.使用IOUtil上传
7.使用IOUtil上传
8.使用数组上传多个文件
9.使用List上传多个文件
----1.基于表单的文件上传-----
fileupload.jsp
<body> <form action="showFile.jsp" name="myForm" method="post" enctype="multipart/form-data"> 选择上传的文件 <input type="file" name="myfile"><br/><br/> <input type="submit" name="mySubmit" value="上传"/> </form> </body>
showFile.jsp
<body> 上传的文件的内容如下: <% InputStream is=request.getInputStream(); InputStreamReader isr=new InputStreamReader(is); BufferedReader br=new BufferedReader(isr); String content=null; while((content=br.readLine())!=null){ out.print(content+"<br/>"); } %> </body>
----2.手动上传-----
通过二进制刘获取上传文件的内容,并将上传的文件内容保存到服务器的某个目录,这样就实现了文件上传。由于这个处理过程完全依赖与开发自己处理二进制流,所以也称为“手动上传”。 从上面的第一个例子可以看到,使用二进制流获取的上传文件的内容与实际文件的内容有还是有一定的区别,包含了很多实际文本中没有的字符。所以需要对获取的内容进行解析,去掉额外的字符。
----3 Struts2.文件上传----
Struts2中使用Common-fileUpload文件上传框架,需要在web应用中增加两个Jar 文件, 即 commons-fileupload.jar. commons-io.jar 需要使用fileUpload拦截器:具体的说明在 struts2-core-2.3.4.jar \org.apache.struts2.interceptor\FileUploadInterceptor.class 里面 下面来看看一点源代码
public class FileUploadInterceptor extends AbstractInterceptor { private static final long serialVersionUID = -4764627478894962478L; protected static final Logger LOG = LoggerFactory.getLogger(FileUploadInterceptor.class); private static final String DEFAULT_MESSAGE = "no.message.found"; protected boolean useActionMessageBundle; protected Long maximumSize; protected Set<String> allowedTypesSet = Collections.emptySet(); protected Set<String> allowedExtensionsSet = Collections.emptySet(); private PatternMatcher matcher; @Inject public void setMatcher(PatternMatcher matcher) { this.matcher = matcher; } public void setUseActionMessageBundle(String value) { this.useActionMessageBundle = Boolean.valueOf(value); } //这就是struts.xml 中param为什么要配置为 allowedExtensions public void setAllowedExtensions(String allowedExtensions) { allowedExtensionsSet = TextParseUtil.commaDelimitedStringToSet(allowedExtensions); } //这就是struts.xml 中param为什么要配置为 allowedTypes 而不是 上面的allowedTypesSet public void setAllowedTypes(String allowedTypes) { allowedTypesSet = TextParseUtil.commaDelimitedStringToSet(allowedTypes); } public void setMaximumSize(Long maximumSize) { this.maximumSize = maximumSize; } }
官员文件初始值大小 上面的类中的说明 <li>maximumSize (optional) - the maximum size (in bytes) that the interceptor will allow a file reference to be set * on the action. Note, this is <b>not</b> related to the various properties found in struts.properties. * Default to approximately 2MB.</li> 具体说的是这个值在struts.properties 中有设置。 下面就来看 里面的设置 ### Parser to handle HTTP POST requests, encoded using the MIME-type multipart/form-data 文件上传解析器 # struts.multipart.parser=cos # struts.multipart.parser=pell #默认 使用jakata框架上传文件 struts.multipart.parser=jakarta #上传时候 默认的临时文件目录 # uses javax.servlet.context.tempdir by default struts.multipart.saveDir= #上传时候默认的大小 struts.multipart.maxSize=2097152
案例:使用FileInputStream FileOutputStream文件流来上传
action.java
package com.sh.action; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; public class MyUpAction extends ActionSupport { private File upload; //上传的文件 private String uploadContentType; //文件的类型 private String uploadFileName; //文件名称 private String savePath; //文件上传的路径 //注意这里的保存路径 public String getSavePath() { return ServletActionContext.getRequest().getRealPath(savePath); } public void setSavePath(String savePath) { this.savePath = savePath; } @Override public String execute() throws Exception { System.out.println("type:"+this.uploadContentType); String fileName=getSavePath()+"\\"+getUploadFileName(); FileOutputStream fos=new FileOutputStream(fileName); FileInputStream fis=new FileInputStream(getUpload()); byte[] b=new byte[1024]; int len=0; while ((len=fis.read(b))>0) { fos.write(b,0,len); } fos.flush(); fos.close(); fis.close(); return SUCCESS; } //get set }
struts.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <constant name="struts.i18n.encoding" value="utf-8"/> <constant name="struts.devMode" value="true"/> <constant name="struts.convention.classes.reload" value="true" /> <constant name="struts.multipart.saveDir" value="f:/tmp"/> <package name="/user" extends="struts-default"> <action name="up" class="com.sh.action.MyUpAction"> <result name="input">/up.jsp</result> <result name="success">/success.jsp</result> <!-- 在web-root目录下新建的一个 upload目录 用于保存上传的文件 --> <param name="savePath">/upload</param> <interceptor-ref name="fileUpload"> <!--采用设置文件的类型 来限制上传文件的类型--> <param name="allowedTypes">text/plain</param> <!--采用设置文件的后缀来限制上传文件的类型 --> <param name="allowedExtensions">png,txt</param> <!--设置文件的大小 默认为 2M [单位:byte] --> <param name="maximumSize">1024000</param> </interceptor-ref> <interceptor-ref name="defaultStack"/> </action> </package> </struts>
up.jsp
<body> <h2>Struts2 上传文件</h2> <s:fielderror/> <s:form action="up" method="post" name="upform" id="form1" enctype="multipart/form-data" theme="simple"> 选择文件: <s:file name="upload" cssStyle="width:300px;"/> <s:submit value="确定"/> </s:form> </body>
success.jsp
<body> <b>上传成功!</b> <s:property value="uploadFileName"/><br/> [img]<s:property value="'upload/'+uploadFileName"/>[/img] </body>
案例:使用FileUtil上传
action.java
package com.sh.action; import java.io.File; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; import java.util.UUID; import org.apache.commons.io.FileUtils; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class FileUtilUpload extends ActionSupport { private File image; //文件 private String imageFileName; //文件名 private String imageContentType;//文件类型 public String execute(){ try { if(image!=null){ //文件保存的父目录 String realPath=ServletActionContext.getServletContext() .getRealPath("/image"); //要保存的新的文件名称 String targetFileName=generateFileName(imageFileName); //利用父子目录穿件文件目录 File savefile=new File(new File(realPath),targetFileName); if(!savefile.getParentFile().exists()){ savefile.getParentFile().mkdirs(); } FileUtils.copyFile(image, savefile); ActionContext.getContext().put("message", "上传成功!"); ActionContext.getContext().put("filePath", targetFileName); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return "success"; } /** * new文件名= 时间 + 随机数 * @param fileName: old文件名 * @return new文件名 */ private String generateFileName(String fileName) { //时间 DateFormat df = new SimpleDateFormat("yyMMddHHmmss"); String formatDate = df.format(new Date()); //随机数 int random = new Random().nextInt(10000); //文件后缀 int position = fileName.lastIndexOf("."); String extension = fileName.substring(position); return formatDate + random + extension; } //get set }
struts.xml
<action name="fileUtilUpload" class="com.sh.action.FileUtilUpload"> <result name="input">/fileutilupload.jsp</result> <result name="success">/fuuSuccess.jsp</result> </action>
fileutilupload.jsp
<form action="${pageContext.request.contextPath }/fileUtilUpload.action" enctype="multipart/form-data" method="post"> 文件:<input type="file" name="image"/> <input type="submit" value="上传"/> </form>
fuuSuccess.jsp
body> <b>${message}</b> ${imageFileName}<br/> <img src="upload/${filePath}"/> </body>
案例:使用IOUtil上传
action.java
package com.sh.action; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.UUID; import org.apache.commons.io.IOUtils; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class IOUtilUpload extends ActionSupport { private File image; //文件 private String imageFileName; //文件名 private String imageContentType;//文件类型 public String execute(){ try { if(image!=null){ //文件保存的父目录 String realPath=ServletActionContext.getServletContext() .getRealPath("/image"); //要保存的新的文件名称 String targetFileName=generateFileName(imageFileName); //利用父子目录穿件文件目录 File savefile=new File(new File(realPath),targetFileName); if(!savefile.getParentFile().exists()){ savefile.getParentFile().mkdirs(); } FileOutputStream fos=new FileOutputStream(savefile); FileInputStream fis=new FileInputStream(image); //如果复制文件的时候 出错了返回 值就是 -1 所以 初始化为 -2 Long result=-2L; //大文件的上传 int smresult=-2; //小文件的上传 //如果文件大于 2GB if(image.length()>1024*2*1024){ result=IOUtils.copyLarge(fis, fos); }else{ smresult=IOUtils.copy(fis, fos); } if(result >-1 || smresult>-1){ ActionContext.getContext().put("message", "上传成功!"); } ActionContext.getContext().put("filePath", targetFileName); } } catch (Exception e) { e.printStackTrace(); } return SUCCESS; } /** * new文件名= 时间 + 全球唯一编号 * @param fileName old文件名 * @return new文件名 */ private String generateFileName(String fileName) { //时间 DateFormat df = new SimpleDateFormat("yy_MM_dd_HH_mm_ss"); String formatDate = df.format(new Date()); //全球唯一编号 String uuid=UUID.randomUUID().toString(); int position = fileName.lastIndexOf("."); String extension = fileName.substring(position); return formatDate + uuid + extension; } //get set }
struts.xml
<action name="iOUtilUpload" class="com.sh.action.IOUtilUpload"> <result name="input">/ioutilupload.jsp</result> <result name="success">/iuuSuccess.jsp</result> </action>
ioutilupload.jsp
<form action="${pageContext.request.contextPath }/iOUtilUpload.action" enctype="multipart/form-data" method="post"> 文件:<input type="file" name="image"/> <input type="submit" value="上传"/> </form>
iuuSuccess.jsp
<body> <b>${message}</b> ${imageFileName}<br/> <img src="image/${filePath}"/> </body>
案例:删除服务器上的文件
/** * 从服务器上 删除文件 * @param fileName 文件名 * @return true: 从服务器上删除成功 false:否则失败 */ public boolean delFile(String fileName){ File file=new File(fileName); if(file.exists()){ return file.delete(); } return false; }
案例:使用数组上传多个文件
action.java
package com.sh.action; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Random; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; /** * @author Administrator * */ public class ArrayUpload extends ActionSupport { private File[] image; private String[] imageContentType; private String[] imageFileName; private String path; public String getPath() { return ServletActionContext.getRequest().getRealPath(path); } public void setPath(String path) { this.path = path; } @Override public String execute() throws Exception { for(int i=0;i<image.length;i++){ imageFileName[i]=getFileName(imageFileName[i]); String targetFileName=getPath()+"\\"+imageFileName[i]; FileOutputStream fos=new FileOutputStream(targetFileName); FileInputStream fis=new FileInputStream(image[i]); byte[] b=new byte[1024]; int len=0; while ((len=fis.read(b))>0) { fos.write(b, 0, len); } } return SUCCESS; } private String getFileName(String fileName){ int position=fileName.lastIndexOf("."); String extension=fileName.substring(position); int radom=new Random().nextInt(1000); return ""+System.currentTimeMillis()+radom+extension; } //get set }
struts.xml
<action name="arrayUpload" class="com.sh.action.ArrayUpload"> <interceptor-ref name="fileUpload"> <param name="allowedTypes"> image/x-png,image/gif,image/bmp,image/jpeg </param> <param name="maximumSize">10240000</param> </interceptor-ref> <interceptor-ref name="defaultStack"/> <param name="path">/image</param> <result name="success">/arraySuccess.jsp</result> <result name="input">/arrayupload.jsp</result> </action>
arrayUpload.jsp
<body> ===========多文件上传================= <form action="${pageContext.request.contextPath }/arrayUpload.action" enctype="multipart/form-data" method="post"> 文件1:<input type="file" name="image"/><br/> 文件2:<input type="file" name="image"/><br/> 文件3:<input type="file" name="image"/> <input type="submit" value="上传"/> </form> </body>
arraySuccess.jsp
<body> <b>使用数组上传成功s:iterator</b> <s:iterator value="imageFileName" status="st"> 第<s:property value="#st.getIndex()+1"/>个图片:<br/> [img]image/<s:property value="imageFileName[#st.getIndex()][/img]"/> </s:iterator> <br/><b>使用数组上传成功c:foreach</b> <c:forEach var="fn" items="${imageFileName}" varStatus="st"> 第${st.index+1}个图片:<br/> <img src="image/${fn}"/> </c:forEach> </body>
案例:使用List上传多个文件
action.java
package com.sh.action; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.List; import java.util.Random; import javax.servlet.Servlet; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; public class ListUpload extends ActionSupport { private List<File> doc; private List<String> docContentType; private List<String> docFileName; private String path; @Override public String execute() throws Exception { for(int i=0;i<doc.size();i++){ docFileName.set(i, getFileName(docFileName.get(i))); FileOutputStream fos=new FileOutputStream(getPath()+"\\"+docFileName.get(i)); File file=doc.get(i); FileInputStream fis=new FileInputStream(file); byte [] b=new byte[1024]; int length=0; while((length=fis.read(b))>0){ fos.write(b,0,length); } } return SUCCESS; } public String getFileName(String fileName){ int position=fileName.lastIndexOf("."); String extension=fileName.substring(position); int radom=new Random().nextInt(1000); return ""+System.currentTimeMillis()+radom+extension; } public String getPath() { return ServletActionContext.getRequest().getRealPath(path); }
strust.xml
<action name="listUpload" class="com.sh.action.ListUpload"> <interceptor-ref name="fileUpload"> <param name="allowedTypes"> image/x-png,image/gif,image/bmp,image/jpeg </param> <param name="maximumSize"> 10240000 </param> </interceptor-ref> <interceptor-ref name="defaultStack"/> <param name="path">/image</param> <result name="success">/listSuccess.jsp</result> <result name="input">/listupload.jsp</result> </action>
listUpload.jsp
<body> ===========List 多文件上传================= <form action="${pageContext.request.contextPath }/listUpload.action" enctype="multipart/form-data" method="post"> 文件1:<input type="file" name="doc"/><br/> 文件2:<input type="file" name="doc"/><br/> 文件3:<input type="file" name="doc"/> <input type="submit" value="上传"/> </form> <s:fielderror/> <s:form action="listUpload" enctype="multipart/form-data"> <s:file name="doc" label="选择上传的文件"/> <s:file name="doc" label="选择上传的文件"/> <s:file name="doc" label="选择上传的文件"/> <s:submit value="上传"/> </s:form> </body>
listSuccess.jsp
<body> <h3>使用List上传多个文件 s:iterator显示</h3> <s:iterator value="docFileName" status="st"> 第<s:property value="#st.getIndex()+1"/>个图片: <br/> <img src="image/<s:property value="docFileName.get(#st.getIndex())"/>"/><br/> </s:iterator> <h3>使用List上传多个文件 c:foreach显示</h3> <c:forEach var="fn" items="${docFileName}" varStatus="st"> 第${st.index}个图片<br/> <img src="image/${fn}"/> </c:forEach> </body>
案例:Struts2 文件下载
Struts2支持文件下载,通过提供的stram结果类型来实现。指定stream结果类型是,还需要指定inputName参数,此参数表示输入流,作为文件下载入口。
简单文件下载 不含中文附件名
package com.sh.action; import java.io.InputStream; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; public class MyDownload extends ActionSupport { private String inputPath; //注意这的 方法名 在struts.xml中要使用到的 public InputStream getTargetFile() { System.out.println(inputPath); return ServletActionContext.getServletContext().getResourceAsStream(inputPath); } public void setInputPath(String inputPath) { this.inputPath = inputPath; } @Override public String execute() throws Exception { // TODO Auto-generated method stub return SUCCESS; } }
Struts.xml
<action name="mydownload" class="com.sh.action.MyDownload"> <!--给action中的属性赋初始值--> <param name="inputPath">/image/1347372060765110.jpg</param> <!--给注意放回后的 type类型--> <result name="success" type="stream"> <!--要下载文件的类型--> <param name="contentType">image/jpeg</param> <!--action文件输入流的方法 getTargetFile()--> <param name="inputName">targetFile</param> <!--文件下载的处理方式 包括内联(inline)和附件(attachment)两种方式---> <param name="contentDisposition">attachment;filename="1347372060765110.jpg"</param> <!---下载缓冲区的大小--> <param name="bufferSize">2048</param> </result> </action>
down.jsp
<body> <h3>Struts 2 的文件下载</h3> <br> <a href="mydownload.action">我要下载</a> </body>
在ie下 可以看到会打开一个 文件下载对话框 有 打开 保存 取消 按钮
google中 没有了
文件下载,支持中文附件名
action
package com.sh.action; import java.io.InputStream; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; public class DownLoadAction extends ActionSupport { private final String DOWNLOADPATH="/image/"; private String fileName; //这个方法 也得注意 struts.xml中也会用到 public InputStream getDownLoadFile(){ return ServletActionContext.getServletContext().getResourceAsStream(DOWNLOADPATH+fileName); } //转换文件名的方法 在strust.xml中会用到 public String getDownLoadChineseFileName(){ String chineseFileName=fileName; try { chineseFileName=new String(chineseFileName.getBytes(),"ISO-8859-1"); } catch (Exception e) { e.printStackTrace(); } return chineseFileName; } @Override public String execute() throws Exception { // TODO Auto-generated method stub return SUCCESS; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } }
struts.xml
<action name="download" class="com.sh.action.DownLoadAction"> <param name="fileName">活动主题.jpg</param> <result name="success" type="stream"> <param name="contentType">image/jpeg</param> <!-- getDownLoadFile() 这个方法---> <param name="inputName">downLoadFile</param> <param name="contentDisposition">attachment;filename="${downLoadChineseFileName}"</param> <param name="bufferSize">2048</param> </result> </action>
down1.jsp
<body> <h3>Struts 2 的文件下载</h3> <br> <a href="download.action">我要下载</a> </body>
- Struts2_fileupload.zip (3.3 MB)
- 下载次数: 204
评论
2 楼
wyj983759591
2014-01-15
下载文件那个
return ServletActionContext.getServletContext().getResourceAsStream(DOWNLOADPATH+fileName);
怎么把临时文件删掉,
先删掉就不能return了
先return,后边在哪写删除
急用!
return ServletActionContext.getServletContext().getResourceAsStream(DOWNLOADPATH+fileName);
怎么把临时文件删掉,
先删掉就不能return了
先return,后边在哪写删除
急用!
1 楼
另一花生
2013-11-30
楼主厉害!
发表评论
-
解决getOutputStream() has already been called for this response
2014-07-30 19:16 3272java.lang.IllegalStateException ... -
Struts2 + ajaxFileUpload 异步上传文件
2013-12-04 19:33 1856ajaxFileUpload下载地址http://www.ph ... -
Struts2 Action 解析提交的XML
2013-10-16 12:30 1594package com.bjdata.bjsearch.p ... -
MyBatis+Spring+Struts2
2012-11-28 00:32 10557MyBatis3.1.1+Spring3.1.2+Struts ... -
Ibatis 整合spring + Struts2 加入OSCACHE
2012-11-14 00:10 4504说明: 使用 spring2.5 +ibatis2.3 ... -
Struts2中使用JfreeChart
2012-11-06 09:02 15901.jar commons-fileupload-1.2.2. ... -
Struts2整合SiteMesh
2012-11-05 10:33 75751.导入Struts2的jar 和 sitemesh.jar ... -
Struts2 编写安全策略(四十五)
2012-09-23 23:53 2248编写安全策略 包含(1 ... -
SSH2整合完整案例(四十三)
2012-09-14 09:34 20584注解配置:Struts2+Spring2.5+Hibernat ... -
Struts2 阻止表单重复 和 等待页面(四十四)
2012-09-23 21:13 2102表单重复提交现象 导 ... -
Struts2 文件上传,下载的类型(四十二)
2012-09-06 23:18 1949声明: 以下复制他人的!!! Struts2 文件上传 之 ... -
Struts2 常用标签使用(三十九)
2012-09-03 09:28 63771.append标签 使用append标签可以把多个集合对 ... -
Struts2 timer拦截器(三十二)
2012-08-31 02:17 20341.Strus2系统拦截器中,timer拦截器可以实现输出Ac ... -
Struts2 常用标签使用(三十九)
2012-09-03 00:50 51.append标签 使用append标签可以把多个集合对 ... -
Struts2 主题和模版设置(四十)
2012-09-03 20:24 4098----------------Struts2 主题----- ... -
Struts2 如何使用OGNL表达式(三十八)
2012-08-30 20:55 50301.OGNL是Object Graph Navitagtion ... -
Struts2 使用Validation框架验证数据(三十七)
2012-08-30 11:25 18405A:在Struts2的框架汇中,开发者可以通过继承Action ... -
Struts2 使用Validation框架验证数据(三十七)
2012-08-29 14:08 9A:在Struts2的框架汇中,开发者可以通过继承Action ... -
Struts2 iterator 标签遍历 Map,List,数组(三十六)
2012-08-26 18:30 204711.使用iterator 标签 遍历 数组,Map,List ... -
Struts2 JSP中将list,set ,Map传递到Action然后<s:iterator>遍历(三十五)
2012-08-26 02:52 19098---------------List------------ ...
相关推荐
struts2的上传,下载,删除文件,可以跑
struts2文件的上传与下载,包含超出指定文件大小之后的提示。更多详细内容,请参考博客:http://blog.csdn.net/qq_20889581/article/details/52838848
struts2 +jquey uploadify3.2 实现多文件上传,可预览、删除、排序 http://blog.csdn.net/ht99582/article/details/9190701
里面有两个文件夹,为up\down,在up里面有一个UpDownFileUtils.java,里面有函数来处理文件上传和文件删除功能。AdminReleaseNoticeAction.jsp里面介绍了上传文件相关的配置,如果你要部署在SSH框架上,里面有具体...
struts2 ajax 实现 批量上传文件(按ctr键 多选,并非多个文件选择输入框的),jar包太大删掉了 仅用了struts2 的jar包 加进去即可
文件上传、多文件上传,文件名 乱码,上传文件名的重名都在此工程中有具体的解决 此工程中为了上传容易,删除了jar包,要使的工程运行,只要加入struts-1.2.9的jar包就可以了
这是一个完整的项目并有详细的代码注释。主要功能:1.用Jquery的uploadify插件实现的多文件上传功能;2.用struts2实现对上传文件的下载功能(其中涉及中文乱码的解决)3.删除某个文件下的某个指定的文件。
Struts2+hibernate+spring实现多文件的上传与下载功能,主要包括:上传、下载、删除 1.能够对多个文件进行上传(可以选择上传文件个数,也即上传文件个数不定) 2.Struts2进行下载处理,能对上传的所有文件进行...
struts2动态上传多文件的实现(内附JavaScript代码) 实现了在页面上动态添加和删除附件
基于Struts2和Spring的网络硬盘系统,批量上传文件和在线解压,优秀源代码! 基于Struts2和Spring的网络硬盘系统,批量上传文件和在线解压,优秀源代码! 基于Struts2和Spring的网络硬盘系统,批量上传文件和在线...
功能强大的Struts2.0+Extjs实现的文件上传,包含文件上传进度,文件的下载,压缩,解压多文件删除等
运用struts技术,可以对文件上传,下载和删除等
该组件在添加数据、更新数据和删除数据时对文件都有不同操作的方法
Spring+Struts2+Ibatis整合例子,jar太大不让上传,删除了,看配置文件吧
使用了struts2上传下载,语言国际化,拦截器,校验框架等。实现功能:用户模块 用户注册 用户登陆修改用户信息 用户等级.管理人员模块,用户删除 用户授权,取消权限。版面模块,添加版面,删除版面。类别模块,添加...
WebUploader ajax上传 demo,对多个文件的选中上传判断和删除显示
一个swfupload和Struts2结合的文件上传于下载以及删除的web项目。大附件上传和多文件上传。
1、blogjava的文件上载要求单个文件不能超过4M,所以,我把web-inf目录下的所有jar文件删除了。 所有jar文件的列表是: commons-beanutils-1.7.0.jar commons-collections-3.2.jar commons-digester-1.6.jar commons...
采用了FCKeditor在线文本编辑器,用FCKeditor上传文件时还存在有问题,不知道是不是配置存在问题,但是图片文件利用Struts2的action上传到服务器,因为有其他附件文件要上传,并且要保存文件信息,在删除文章时要把...