Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ServletFileUpload itemIterator没有元素_Java_Spring_Apache Commons Fileupload - Fatal编程技术网

Java ServletFileUpload itemIterator没有元素

Java ServletFileUpload itemIterator没有元素,java,spring,apache-commons-fileupload,Java,Spring,Apache Commons Fileupload,我有一个带有文件上传的web应用程序,使用以下代码: ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter = upload.getItemIterator(request); while(iter.hasNext()) { //some actions } 在独立应用程序中,部署在tomcat上的所有组件都可以正常工作。但当我将这个控制器作为jar导入另一个web应用程序时,迭代器没有任何项

我有一个带有文件上传的web应用程序,使用以下代码:

ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter = upload.getItemIterator(request);
while(iter.hasNext())
{
    //some actions
}

在独立应用程序中,部署在tomcat上的所有组件都可以正常工作。但当我将这个控制器作为jar导入另一个web应用程序时,迭代器没有任何项<代码>请求。getParameterMap()不是空的,但它没有关于文件的信息。

确保表单的标记正确-方法是POST,enctype是multipart/form data标记和方法正确-代码中没有任何更改,只是从独立应用程序转到导入的库。发送到服务器的请求是相同的(如chrome控制台所述)。