java web 使用上传组价smartupload时出现异常
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: 17 in the jsp file: /book/AddBookcheck.jsp
SmartUpload cannot be resolved to a type
14: <body>
15:
16: <%
17: SmartUpload smart = new SmartUpload();
18: smart.initialize(pageContext);
19: smart.upload();
20: Files f = smart.getFiles();
An error occurred at line: 17 in the jsp file: /book/AddBookcheck.jsp
SmartUpload cannot be resolved to a type
14: <body>
15:
16: <%
17: SmartUpload smart = new SmartUpload();
18: smart.initialize(pageContext);
19: smart.upload();
20: Files f = smart.getFiles();
An error occurred at line: 20 in the jsp file: /book/AddBookcheck.jsp
Files cannot be resolved to a type
17: SmartUpload smart = new SmartUpload();
18: smart.initialize(pageContext);
19: smart.upload();
20: Files f = smart.getFiles();
21: File fil = f.getFile(0);
22: String ext = fil.getFileExt();
23: if (!(ext.equals("jpg"))) {
An error occurred at line: 21 in the jsp file: /book/AddBookcheck.jsp
File cannot be resolved to a type
18: smart.initialize(pageContext);
19: smart.upload();
20: Files f = smart.getFiles();
21: File fil = f.getFile(0);
22: String ext = fil.getFileExt();
23: if (!(ext.equals("jpg"))) {
24: out.println("<script type='text/javascript'>alert('文件类型错误,应该为*.jpg');location.replace('AddBook.jsp');</script>");
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
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:317)
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.13 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.13