Struts2 file upload (multiple file upload)
class=”htmledit_views”> Look at the effect picture first: Input Interface result page Enter interface code: Insert title here Multiple file upload File title: Select file 1: Select file 2: Select file 3: action part code: package com.hcj.action; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.List; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; public class UploadManyAction extends ActionSupport { //Encapsulate the attributes of the file header request parameter private String title; //Encapsulate the attributes of the uploaded file domain (the attribute name is the same as the name value in the front-end input) private List upload; //Encapsulate the attribute of the uploaded file type (the attribute name is the foreground name value +ContentType, if the foreground name value here is upload, so here is uploadContentType) private List uploadContentType; //Encapsulate the attribute of the uploaded file name (the attribute name is the foreground name value + FileName, if the foreground name value here is upload, so here is uploadFileName) private List uploadFileName; //Configure the save path (configure directly in the struts.xml file) private String savePath; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List getUpload() { return upload; } public void setUpload(List upload) { this.upload = upload;…