当前位置: 代码迷 >> Java Web开发 >> 大家帮我看下这错误该怎么改?
  详细解决方案

大家帮我看下这错误该怎么改?

热度:179   发布时间:2007-12-08 16:11:49.0
大家帮我看下这错误该怎么改?
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

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



An error occurred at line: 37 in the jsp file: /upload.jsp
ServletFileUpload cannot be resolved
34: %>
35: <%
36:     // Check that we have a file upload request
37:     boolean isMultipart = ServletFileUpload.isMultipartContent(request);
38:     if (isMultipart) {
39:         // Create a factory for disk-based file items
40:         org.apache.commons.fileupload.FileItemFactory factory = new DiskFileItemFactory();


An error occurred at line: 40 in the jsp file: /upload.jsp
org.apache.commons.fileupload.FileItemFactory cannot be resolved to a type
37:     boolean isMultipart = ServletFileUpload.isMultipartContent(request);
38:     if (isMultipart) {
39:         // Create a factory for disk-based file items
40:         org.apache.commons.fileupload.FileItemFactory factory = new DiskFileItemFactory();
41:         // Create a new file upload handler
42:         ServletFileUpload upload = new ServletFileUpload(factory);
43:         // Parse the request


An error occurred at line: 40 in the jsp file: /upload.jsp
DiskFileItemFactory cannot be resolved to a type
37:     boolean isMultipart = ServletFileUpload.isMultipartContent(request);
38:     if (isMultipart) {
39:         // Create a factory for disk-based file items
40:         org.apache.commons.fileupload.FileItemFactory factory = new DiskFileItemFactory();
41:         // Create a new file upload handler
42:         ServletFileUpload upload = new ServletFileUpload(factory);
43:         // Parse the request


An error occurred at line: 42 in the jsp file: /upload.jsp
ServletFileUpload cannot be resolved to a type
39:         // Create a factory for disk-based file items
40:         org.apache.commons.fileupload.FileItemFactory factory = new DiskFileItemFactory();
41:         // Create a new file upload handler
42:         ServletFileUpload upload = new ServletFileUpload(factory);
43:         // Parse the request
44:         List /* FileItem */items = upload.parseRequest(request);
45:         // Process the uploaded items


An error occurred at line: 42 in the jsp file: /upload.jsp
ServletFileUpload cannot be resolved to a type
39:         // Create a factory for disk-based file items
40:         org.apache.commons.fileupload.FileItemFactory factory = new DiskFileItemFactory();
41:         // Create a new file upload handler
42:         ServletFileUpload upload = new ServletFileUpload(factory);
43:         // Parse the request
44:         List /* FileItem */items = upload.parseRequest(request);
45:         // Process the uploaded items


An error occurred at line: 48 in the jsp file: /upload.jsp
org.apache.commons.fileupload.FileItem cannot be resolved to a type
45:         // Process the uploaded items
46:         Iterator iter = items.iterator();
47:         while (iter.hasNext()) {
48:             org.apache.commons.fileupload.FileItem item = (org.apache.commons.fileupload.FileItem) iter
49:                     .next();
50:             if (item.isFormField()) {
51:                 String name = item.getFieldName();


An error occurred at line: 48 in the jsp file: /upload.jsp
org.apache.commons.fileupload.FileItem cannot be resolved to a type
45:         // Process the uploaded items
46:         Iterator iter = items.iterator();
47:         while (iter.hasNext()) {
48:             org.apache.commons.fileupload.FileItem item = (org.apache.commons.fileupload.FileItem) iter
49:                     .next();
50:             if (item.isFormField()) {
51:                 String name = item.getFieldName();


Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.

这是怎么了,我在MyEclipse里做文件上传,commons-fileupload-1.2.jar commons-io-1.3.2.jar都加进去了,和别人用的相同的代码,为什么他的可以运行,而我的却出现这个错误?
搜索更多相关主题的帖子: class  occurred  server  cannot  

----------------解决方案--------------------------------------------------------
jsp页面有错误,仔细检查一下
----------------解决方案--------------------------------------------------------
先自己检查一下吧
----------------解决方案--------------------------------------------------------
我都检查好几遍了,谢谢各位的回答!
呵呵,我用jspsmart 做出来了。可是上面的报错信息我真是看不懂,那出问题了?那代码是老师给的!不会错吧?我什么都没动啊!怎么会报上面的错啊?不是我一个人的是这样,有的人的可以,有的就不行,好奇怪
----------------解决方案--------------------------------------------------------
哦,对了,要限定时间上传怎么做?也就是到了一定时间,不让上传.。这代码我该怎么写?
----------------解决方案--------------------------------------------------------
试试下面 upload.jar 看看
[url]http://download.csdn.net/source/306682[/url]
----------------解决方案--------------------------------------------------------
谢谢,jsp页面没问题,现在已经可以上传了!
我又建了一个新工程,导进去,直接就可以用了。估计是我开始时工程建得有问题吧!
顺便再问下:如果MyEclipse装得时候,没把它装在eclipse中的plugins文件夹中,那么日后会有什么影响?
----------------解决方案--------------------------------------------------------
  相关解决方案