日期:2014-05-20 浏览次数:20806 次
。。。菜鸟问题。。。
页面代码: <% SmartUpload mysmartload =new SmartUpload(); long file_size_max=10*1024*1024; String filename=""; // 文件名 String ext=""; //后缀名 String testVal =""; // String url="Images/"; // 保存文件目录 mysmartload.initialize(pageContext); // 初始化 try { mysmartload.setAllowedFilesList("jpg,gif,png,jpeg,bmp"); // 允许上传的文件类型 mysmartload.upload(); } catch(Exception e) { %> <script language="javascript"> alert("只允许上传.jpg和.gif类型图片文件"); </script> <% } try { com.jspsmart.upload.File myfile = mysmartload.getFiles().getFile(0); if(myfile.isMissing()) { %> <script language="javascript"> alert("请先选择要上传的文件"); </script> <% } else { String myfilename=myfile.getFileName(); // 获取上传文件的文件名 ext=myfile.getFileExt(); // 获取上传文件的后缀名 int file_size=myfile.getSize(); // 获取上传文件的大小 String savaurl=""; if(file_size<file_size_max) { savaurl = application.getRealPath("upload/")+url; savaurl+= filename+"."+ext; // 文件全名 // 保存路 myfile.saveAs(savaurl,SmartUpload.SAVE_PHYSICAL); // 输出 Out.print() } } catch (Exception ex){ System.out.print(ex.toString()); } %> 错误异常: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 15 in the generated java file Only a type can be imported. com.jspsmart.upload.File resolves to a package An error occurred at line: 14 in the jsp file: /WebRoot/Uploadfile.jsp SmartUpload cannot be resolved to a type 11: 12: <% 13: 14: SmartUpload mysmartload =new SmartUpload(); 15: 16: long file_size_max=10*1024*1024; 17: An error occurred at line: 14 in the jsp file: /WebRoot/Uploadfile.jsp SmartUpload cannot be resolved to a type 11: 12: <% 13: 14: SmartUpload mysmartload =new SmartUpload(); 15: 16: long file_size_max=10*1024*1024; 17: An error occurred at line: 48 in the jsp file: /WebRoot/Uploadfile.jsp com.jspsmart.upload.File cannot be resolved to a type 45: } 46: try 47: { 48: com.jspsmart.upload.File myfile = mysmartload.getFiles().getFile(0); 49: if(myfile.isMissing()) 50: { 51: %> An error occurred at line: 78 in the jsp file: /WebRoot/Uploadfile.jsp SmartUpload.SAVE_PHYSICAL cannot be resolved to a type 75: 76: // 保存路径 77: 78: myfile.saveAs(savaurl,SmartUpload.SAVE_PHYSICAL); 79: 80: 81: // 输出 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:317) org.apache.jasper.compiler.Compiler.compile(Compiler.java:295) org.apache.jasper.compiler.Compiler.compile(Compiler.java:282) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
哪位大神帮看一看...