在带有StrutAction类的jsp页面中使用文件上传jquery插件

在带有StrutAction类的jsp页面中使用文件上传jquery插件,jquery,file-upload,struts2,Jquery,File Upload,Struts2,我知道有很多jquery插件可用于文件上载。但它只是显示了我们如何在jsp页面中添加它。但我想知道我们如何处理在后端使用这些插件选择的文件。例如,我使用spring with struts2。因此,我想从jsp在我的action类中发送这些文件,并将其存储在中服务器位置。任何人都知道我该怎么做。userImage是标记的名称 public class FileUploadAction extends ActionSupport{ private File userImage;

我知道有很多jquery插件可用于文件上载。但它只是显示了我们如何在jsp页面中添加它。但我想知道我们如何处理在后端使用这些插件选择的文件。例如,我使用spring with struts2。因此,我想从jsp在我的action类中发送这些文件,并将其存储在中服务器位置。任何人都知道我该怎么做。

userImage
标记的名称

 public class FileUploadAction extends ActionSupport{
        private File userImage;
        private String userImageContentType;
        private String userImageFileName;

        private HttpServletRequest servletRequest;

        public String execute() {
            try {
                String filePath = "yourPath";
                File fileToCreate = new File(filePath, this.userImageFileName);

                FileUtils.copyFile(this.userImage, fileToCreate);
            } catch (Exception e) {
                e.printStackTrace();
                addActionError(e.getMessage());

                return INPUT;
            }
            return SUCCESS;
        }

    }


解释多文件上载usinf List

userImage
标记的名称

 public class FileUploadAction extends ActionSupport{
        private File userImage;
        private String userImageContentType;
        private String userImageFileName;

        private HttpServletRequest servletRequest;

        public String execute() {
            try {
                String filePath = "yourPath";
                File fileToCreate = new File(filePath, this.userImageFileName);

                FileUtils.copyFile(this.userImage, fileToCreate);
            } catch (Exception e) {
                e.printStackTrace();
                addActionError(e.getMessage());

                return INPUT;
            }
            return SUCCESS;
        }

    }


解释多文件上载usinf List

am extending crudActionSupport。我可以在我的操作类am extending crudActionSupport中使用上述方法吗?我可以在我的操作类中使用上述方法吗