You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Shervin Asgari <sh...@linpro.no> on 2006/11/15 16:31:55 UTC

Cannot find FileItemIterator.

Hello.

I am trying to test FileUpload, and used a sample from the User Guide 
and Streaming Guide. But I get the same error.

I have uploaded the commons-fileupload.1.1 to my WEB-INF/lib directory 
and when the first test, which is

boolean isMultipart = ServletFileUpload.isMultipartContent(request);
returns true.
So I know I have a multipart/form-data

But when I try to read the data I get an error.
FileItemIterator iter = upload.getItemIterator(request);

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 8 in the jsp file: /test/uploadPhoto.jsp
Generated servlet error:
FileItemIterator cannot be resolved to a type


It seems it cannot find FileItemIterator. I have imported
<%@ page import="org.apache.commons.fileupload.*"%>
and in desperation I tried to import mostly all I found logical
<%@ page import="org.apache.commons.fileupload.servlet.*"%>
<%@ page import="org.apache.commons.fileupload.portlet.*"%>
<%@ page import="org.apache.commons.collections.*"%>

but still I get the same error. What am I doing wrong? I am using Java 
1.4.2, maybe I have to use 1.5?
Could that be the problem?

-- 
Shervin Asgari - System Consultant
M: +47 918 64 148, @: shervin@linpro.no
Linpro AS - Leading on Linux	Tel: +47 21 54 41 00/02
Vitaminveien 1A        Fax: +47 21 54 41 01
PB 4 Grefsen, 0409 Oslo    WWW: http://www.linpro.no/


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Cannot find FileItemIterator.

Posted by Shervin Asgari <sh...@linpro.no>.
Please help. I still have this issue.

Shervin Asgari - System Consultant


Shervin Asgari wrote:
> Hello.
>
> I am trying to test FileUpload, and used a sample from the User Guide 
> and Streaming Guide. But I get the same error.
>
> I have uploaded the commons-fileupload.1.1 to my WEB-INF/lib directory 
> and when the first test, which is
>
> boolean isMultipart = ServletFileUpload.isMultipartContent(request);
> returns true.
> So I know I have a multipart/form-data
>
> But when I try to read the data I get an error.
> FileItemIterator iter = upload.getItemIterator(request);
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> An error occurred at line: 8 in the jsp file: /test/uploadPhoto.jsp
> Generated servlet error:
> FileItemIterator cannot be resolved to a type
>
>
> It seems it cannot find FileItemIterator. I have imported
> <%@ page import="org.apache.commons.fileupload.*"%>
> and in desperation I tried to import mostly all I found logical
> <%@ page import="org.apache.commons.fileupload.servlet.*"%>
> <%@ page import="org.apache.commons.fileupload.portlet.*"%>
> <%@ page import="org.apache.commons.collections.*"%>
>
> but still I get the same error. What am I doing wrong? I am using Java 
> 1.4.2, maybe I have to use 1.5?
> Could that be the problem?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Cannot find FileItemIterator.

Posted by Shervin Asgari <sh...@linpro.no>.
I will. But somehow I need to read the data before I can send it to a bean.

Shervin

James Carman wrote:
> As a side note, you might consider not polluting your "view" code
> (your JSPs) with such complicated logic.  Try moving this sort of code
> into a helper bean or something.
>
>
> On 11/15/06, Shervin Asgari <sh...@linpro.no> wrote:
>> Hello.
>>
>> I am trying to test FileUpload, and used a sample from the User Guide
>> and Streaming Guide. But I get the same error.
>>
>> I have uploaded the commons-fileupload.1.1 to my WEB-INF/lib directory
>> and when the first test, which is
>>
>> boolean isMultipart = ServletFileUpload.isMultipartContent(request);
>> returns true.
>> So I know I have a multipart/form-data
>>
>> But when I try to read the data I get an error.
>> FileItemIterator iter = upload.getItemIterator(request);
>>
>> org.apache.jasper.JasperException: Unable to compile class for JSP
>>
>> An error occurred at line: 8 in the jsp file: /test/uploadPhoto.jsp
>> Generated servlet error:
>> FileItemIterator cannot be resolved to a type
>>
>>
>> It seems it cannot find FileItemIterator. I have imported
>> <%@ page import="org.apache.commons.fileupload.*"%>
>> and in desperation I tried to import mostly all I found logical
>> <%@ page import="org.apache.commons.fileupload.servlet.*"%>
>> <%@ page import="org.apache.commons.fileupload.portlet.*"%>
>> <%@ page import="org.apache.commons.collections.*"%>
>>
>> but still I get the same error. What am I doing wrong? I am using Java
>> 1.4.2, maybe I have to use 1.5?
>> Could that be the problem?
>>
>> -- 
>> Shervin Asgari - System Consultant
>> M: +47 918 64 148, @: shervin@linpro.no
>> Linpro AS - Leading on Linux    Tel: +47 21 54 41 00/02
>> Vitaminveien 1A        Fax: +47 21 54 41 01
>> PB 4 Grefsen, 0409 Oslo    WWW: http://www.linpro.no/
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Cannot find FileItemIterator.

Posted by James Carman <ja...@carmanconsulting.com>.
As a side note, you might consider not polluting your "view" code
(your JSPs) with such complicated logic.  Try moving this sort of code
into a helper bean or something.


On 11/15/06, Shervin Asgari <sh...@linpro.no> wrote:
> Hello.
>
> I am trying to test FileUpload, and used a sample from the User Guide
> and Streaming Guide. But I get the same error.
>
> I have uploaded the commons-fileupload.1.1 to my WEB-INF/lib directory
> and when the first test, which is
>
> boolean isMultipart = ServletFileUpload.isMultipartContent(request);
> returns true.
> So I know I have a multipart/form-data
>
> But when I try to read the data I get an error.
> FileItemIterator iter = upload.getItemIterator(request);
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> An error occurred at line: 8 in the jsp file: /test/uploadPhoto.jsp
> Generated servlet error:
> FileItemIterator cannot be resolved to a type
>
>
> It seems it cannot find FileItemIterator. I have imported
> <%@ page import="org.apache.commons.fileupload.*"%>
> and in desperation I tried to import mostly all I found logical
> <%@ page import="org.apache.commons.fileupload.servlet.*"%>
> <%@ page import="org.apache.commons.fileupload.portlet.*"%>
> <%@ page import="org.apache.commons.collections.*"%>
>
> but still I get the same error. What am I doing wrong? I am using Java
> 1.4.2, maybe I have to use 1.5?
> Could that be the problem?
>
> --
> Shervin Asgari - System Consultant
> M: +47 918 64 148, @: shervin@linpro.no
> Linpro AS - Leading on Linux    Tel: +47 21 54 41 00/02
> Vitaminveien 1A        Fax: +47 21 54 41 01
> PB 4 Grefsen, 0409 Oslo    WWW: http://www.linpro.no/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Cannot find FileItemIterator.

Posted by Martin Cooper <ma...@apache.org>.
On 11/15/06, Shervin Asgari <sh...@linpro.no> wrote:
>
> Hello.
>
> I am trying to test FileUpload, and used a sample from the User Guide
> and Streaming Guide. But I get the same error.
>
> I have uploaded the commons-fileupload.1.1 to my WEB-INF/lib directory


The streaming API is only available in nightly builds. It has not been
released. So you have two options:

1) Use the FileUpload 1.1.1 API as documented in the User Guide.
(Recommended.)
2) Use the streaming API with a nightly build of FileUpload.

--
Martin Cooper


and when the first test, which is
>
> boolean isMultipart = ServletFileUpload.isMultipartContent(request);
> returns true.
> So I know I have a multipart/form-data
>
> But when I try to read the data I get an error.
> FileItemIterator iter = upload.getItemIterator(request);
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> An error occurred at line: 8 in the jsp file: /test/uploadPhoto.jsp
> Generated servlet error:
> FileItemIterator cannot be resolved to a type
>
>
> It seems it cannot find FileItemIterator. I have imported
> <%@ page import="org.apache.commons.fileupload.*"%>
> and in desperation I tried to import mostly all I found logical
> <%@ page import="org.apache.commons.fileupload.servlet.*"%>
> <%@ page import="org.apache.commons.fileupload.portlet.*"%>
> <%@ page import="org.apache.commons.collections.*"%>
>
> but still I get the same error. What am I doing wrong? I am using Java
> 1.4.2, maybe I have to use 1.5?
> Could that be the problem?
>
> --
> Shervin Asgari - System Consultant
> M: +47 918 64 148, @: shervin@linpro.no
> Linpro AS - Leading on Linux    Tel: +47 21 54 41 00/02
> Vitaminveien 1A        Fax: +47 21 54 41 01
> PB 4 Grefsen, 0409 Oslo    WWW: http://www.linpro.no/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>