日期:2014-05-18  浏览次数:20707 次

请教关于fileUpload的问题

从jakarta下载的commons-fileupload-1.1.1.jar
放到的我的站点的web-inf/lib下面
运行后错误提示:
An   error   occurred   at   line:   17   in   the   jsp   file:   /upload/upload_do.jsp
Generated   servlet   error:
ServletFileUpload   cannot   be   resolved

不知道是为什么,很奇怪的问题,我是按照步骤来的啊

上传的页面程序如下:
<%@   page   contentType= "text/html;charset=gb2312 "   %>
<%@   page   import= "org.apache.commons.fileupload.* "   %>
<%@   page   import= "java.util.* "   %>
<%@   page   import= "java.io.* "   %>
<%
    boolean   isMultipart   =   ServletFileUpload.isMultipartContent(request);
    if(isMultipart==true){
    DiskFileUpload   upload=new   DiskFileUpload();
    List   items=upload.parseRequest(request);
    Iterator   itr=items.iterator();
    while(itr.hasNext()){
FileItem   item=(FileItem)itr.next();
if(item.isFormField()){
String   fieldName=item.getFieldName();
if(fieldName.equals( "name ")){
out.print( "The   field   name   is   "+fieldName);
out.print( " <br/> ");
}else{
out.print( "The   upload   filename   is "+item.getName());
out.print( " <br/> ");
}
}
    }
    }else{
out.print( "The   enctype   must   be   multipart/form-data ");
    }

%>


我是新手,搜了一些资料,还是解决不了,只好上来问了



------解决方案--------------------
COMMONS-IO。JAR
------解决方案--------------------
好象还有一个类没有引用..要用这种组件上传..有二个封装.jar叫什么finde忘了