symbol not found
i am makin a web application for uploading files using jsp
netbeans tomcat...
i m using commons package for uploading files....
i have added commons library in particular web application also and in
java library manager also....
but whenever i compile my code...
wherever i using function of commons package i get the error....
symbols not found....
please
please
please help me......
# 2
this is html code:
<html>
<head>
<title>video upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="default.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action="first.jsp" method="post"
enctype="multipart/form-data" name="form1" id="form1">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td width="25%"><strong>File</strong></td>
<td><input type="file" name="file" /></td>
</tr>
<tr>
<td width="25%"><strong>Comment</strong></td>
<td><input name="Comment" type="text" size="50"
maxlength="250"></td>
</tr>
<tr>
<td width="25%"> </td>
<td><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</form>
</body>
</html>
jsp code:
<%@ page import="java.io.*" %>
<%@ page import= "java.util.*" %>
<%@ page import= "org.apache.commons.fileupload.*" %>
<%@ page import="org.apache.commons.io.*" %>
<%@ page import= "javax.servlet.http.HttpServletRequest.*" %>
<% boolean isMultipart = ServletFileUpload.isMultipartContent(request);
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
List /* FileItem */ items = upload.parseRequest(request);
// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
processFormField(item);
} else {
processUploadedFile(item);
}
}
File uploadedFile = new File("/");
item.write(uploadedFile);
%>
error:
/home/anshul/upload2/build/generated/src/org/apache/jsp/first_jsp.java:53: cannot find symbol
symbol : variable ServletFileUpload
location: class org.apache.jsp.first_jsp
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
^
/home/anshul/upload2/build/generated/src/org/apache/jsp/first_jsp.java:56: cannot find symbol
symbol : class DiskFileItemFactory
location: class org.apache.jsp.first_jsp
FileItemFactory factory = new DiskFileItemFactory();
^
/home/anshul/upload2/build/generated/src/org/apache/jsp/first_jsp.java:59: cannot find symbol
symbol : class ServletFileUpload
location: class org.apache.jsp.first_jsp
ServletFileUpload upload = new ServletFileUpload(factory);
^
/home/anshul/upload2/build/generated/src/org/apache/jsp/first_jsp.java:59: cannot find symbol
symbol : class ServletFileUpload
location: class org.apache.jsp.first_jsp
ServletFileUpload upload = new ServletFileUpload(factory);
^
/home/anshul/upload2/build/generated/src/org/apache/jsp/first_jsp.java:70: cannot find symbol
symbol : method processFormField(org.apache.commons.fileupload.FileItem)
location: class org.apache.jsp.first_jsp
processFormField(item);
^
/home/anshul/upload2/build/generated/src/org/apache/jsp/first_jsp.java:72: cannot find symbol
symbol : method processUploadedFile(org.apache.commons.fileupload.FileItem)
location: class org.apache.jsp.first_jsp
processUploadedFile(item);
^
/home/anshul/upload2/build/generated/src/org/apache/jsp/first_jsp.java:76: cannot find symbol
symbol : variable item
location: class org.apache.jsp.first_jsp
item.write(uploadedFile);
^
7 errors
/home/anshul/upload2/nbproject/build-impl.xml:353: The following error occurred while executing this line:
/home/anshul/upload2/nbproject/build-impl.xml:141: Compile failed; see the compiler error output for details.