日期:2014-05-17  浏览次数:20959 次

用tomcat做Fileupload文件上传出现以下异常信息
页面抛出以下,异常信息,求解应该错在什么位置?

An error occurred at line: 11 in the jsp file: /FileUploadDemo/fileupload_demo01.jsp
Factory cannot be resolved
8: <body>
9: <%
10: DiskFileItemFactory factory=new DiskFileItemFactory();
11: ServletFileUpload upload=new ServletFileUpload(Factory);
12: upload.setFileSizeMax(3145728);
13: List<FileItem> items=upload.parseRequest(request);
14: Iterator<fileItem> iter=items.iterator();


An error occurred at line: 14 in the jsp file: /FileUploadDemo/fileupload_demo01.jsp
fileItem cannot be resolved to a type
11: ServletFileUpload upload=new ServletFileUpload(Factory);
12: upload.setFileSizeMax(3145728);
13: List<FileItem> items=upload.parseRequest(request);
14: Iterator<fileItem> iter=items.iterator();
15: while(iter.hasNext()){
16: FileItem item=iter.next();
17: String filedName=item.getFieldName();


An error occurred at line: 19 in the jsp file: /FileUploadDemo/fileupload_demo01.jsp
fieldName cannot be resolved
16: FileItem item=iter.next();
17: String filedName=item.getFieldName();
18: %>
19: <ul><h4>表单控件名称:<%=fieldName%>--><%=item.isFormField()%></h4>
20: <%
21: if(!item.isFormField()){
22: String fileName=item.getName();


------解决方案--------------------
类型问题
看看你11行类型转换的时候是否有问题