parseRequest(RequestContext)还是parseRequest(HttpServletRequest)

今天写jsp文件下载demo的时候遇到一个奇怪的问题, List list=upload.parseRequest(req);报了一个类型不兼容的错,具体提示如下:
The method parseRequest(RequestContext) in the type FileUploadBase is not applicable for the arguments (HttpServletRequest)
检查了半天才发现是导错包了,默认导入的是
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.apache.tomcat.util.http.fileupload.FileUploadException;
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;系列
实际要导的是
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
当然,导这个之前要先把对应的common包jar复制到lib中

你可能感兴趣的:(文件下载,jsp,导包)