Struts2 File Upload and download

Source: Internet
Author: User
Tags constant file upload temporary file storage

This article is mainly written about struts2 file upload and download (Chinese file name problem resolution).

When using, enter directly in the Address bar: http://localhost:8080/fud/Enter

Detailed configuration is shown in the following code:
Configuration of the Struts.xml file

[XHTML]  View Plain Copy <?xml version= "1.0"  encoding= "UTF-8"  ?>   <! doctype struts public  "-//apache software foundation//dtd struts  configuration 2.1//en " " HTTP://STRUTS.APACHE.ORG/DTDS/STRUTS-2.1.DTD ">   <struts>        <!--  Setting the default encoding format  -->       < Constant name= "struts.i18n.encoding"  value= "GBK"  />       <! --  Setting the maximum upload file is 300m -->       <constant name= " Struts.multipart.maxSize " value=" 314572800 " />       <!--  Set the default temporary file storage location  -->       <constant name= "Struts.multipart.saveDir"  value= "C:/fileupload"  />       <!--  setting debug mode  -->        <constaNt name= "Struts.devmode"  value= "true" ></constant>       < Package name= "FileUpload"  extends= "Struts-default"  namespace= "/file" >            <!--  File upload  -->            <action name= "Upload"  class= "com.file.action.FileUploadAction" >                <result type= " Redirectaction ">                    <param name= "ActionName" >list</param>                    <param name= "namespace" >/ file</param>               </ result>   &NBSP;&NBsp;      </action>            <!--  Download files  -->           <action  name= "Download"  class= "com.file.action.FileDownloadAction" >                <result type= "Stream"  name= "Success" >   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.