Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

cannot find symbol: ServletFileUpload

843840Feb 14 2009 — edited Feb 16 2009
Hey Guys/Gals,

Im attempting to setup commons FileUpload. I am following the instructions from the apache commons page but am having some minor first timer problems :)

fileUpload.jsp
<%@ page import="org.apache.commons.fileupload.servlet.*" %>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="org.apache.commons.*"%>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.portlet.*" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        
        <%
        // Check that we have a file upload request
        boolean isMultipart = ServletFileUpload.isMultipartContent(request);
        
        if(isMultipart==true){
            System.out.println("isMultipart true");
        }
        %>
        
    </body>
</html>
I got the code directly from the apache commons site, i have the following .jar and .zip files in the classpath of both the application and the web server (common/lib).

commons-io-1.4.jar
commons-fileupload-1.1.1.zip
portlet-api.jar

And the error is the following:
org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
C:\Documents and Settings\rquigley\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\PhotoAlbum\org\apache\jsp\FileUpload\fileUpload_jsp.java:6: package org.apache.commons.fileupload.servlet does not exist
import org.apache.commons.fileupload.servlet.*;
^


An error occurred at line: 26 in the jsp file: /FileUpload/fileUpload.jsp
Generated servlet error:
C:\Documents and Settings\rquigley\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\PhotoAlbum\org\apache\jsp\FileUpload\fileUpload_jsp.java:68: cannot find symbol
symbol  : variable ServletFileUpload
location: class org.apache.jsp.FileUpload.fileUpload_jsp
        boolean isMultipart = ServletFileUpload.isMultipartContent(request);
                              ^
2 errors



	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
I send a multipart post from another page:
FORM ACTION="FileUpload/fileUpload.jsp" METHOD="post" ENCTYPE="multipart/form-data">
            <input type="file" name="file" value=""/>
            <input type="submit" name="submit" value="Submit"/>
</form>
Any idears would be great.

Thanks
Rob
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2009
Added on Feb 14 2009
4 comments
1,441 views