写完后调试的过程中,老报错:java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream,少了commons-io.jar,加上后,就ok了在Controller端,可以用以下方式取得上传的文件,可以上传多个文件: public Set getMultipartFileForForm(HttpServletRequest req) { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) req; // CommonsMultipartFile file = (CommonsMultipartFile) // multipartRequest.getFile("attach");//attach为form为file的id值 // MultipartHttpServletRequest multipartRequest = // (MultipartHttpServletRequest)request; Set fileset = new LinkedHashSet(); for (Iterator it = multipartRequest.getFileNames(); it.hasNext();) { String key = (String) it.next(); MultipartFile file = multipartRequest.getFile(key); if (file.getOriginalFilename().length() > 0) { fileset.add(file); } } return fileset; }