日期:2014-05-17  浏览次数:20582 次

求一个实现上传和下载文件的例子
最好下载的比较详细,小弟新手,感激不尽
邮箱:sun910601@sina.com

------解决方案--------------------

    <?xml version="1.0" encoding="UTF-8"?>  
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"  
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  
        <filter>  
            <filter-name>struts2</filter-name>  
            <filter-class>  
                org.apache.struts2.dispatcher.FilterDispatcher  
            </filter-class>  
        </filter>  
        <filter-mapping>  
            <filter-name>struts2</filter-name>  
            <url-pattern>*.action</url-pattern>  
        </filter-mapping>  
        <welcome-file-list>  
            <welcome-file>index.jsp</welcome-file>  
        </welcome-file-list>  
    </web-app>  



?xml version="1.0" encoding="UTF-8" ?>  
<!DOCTYPE struts PUBLIC  
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"  
    "http://struts.apache.org/dtds/struts-2.0.dtd">  
<struts>  
    <constant name="struts.devMode" value="false" />  
    <!-- 改变struts2默认为2M的上传文件大小限制 -->  
    <constant name="struts.multipart.maxSize" value="10240000"/>  
    <package name="upload" extends="struts-default">  
        <action name="uploadFile" class="com.labci.struts2.action.UploadFileAction">  
            <param name="savePath">/upload</param>  
            <param name="allowTypes">text/