错误提示是 Error 500--Internal Server Error 
java.lang.Error: Unresolved compilation problems: 
The constructor File(String) is undefined
The method exists() is undefined for the type File at com.jspsmart.upload.SmartUpload.getPhysicalPath(SmartUpload.java:620)
at com.jspsmart.upload.File.saveAs(File.java:67)
at com.jspsmart.upload.File.saveAs(File.java:60)
at jsp_servlet._budget.__doup._jspService(__doup.java:150)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:526)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)我的源代码是
 SmartUpload smartUpload = new SmartUpload();
  smartUpload.initialize(pageContext);
      smartUpload.upload();
   
      com.jspsmart.upload.File smartFile = smartUpload.getFiles().getFile(0);
      
      String fileName = "E:\\aaa\\"+smartFile.getFileName();      System.out.print(" fileName="+fileName );
       
      smartFile.saveAs(fileName);      绝对路径肯定存在
       
      后来又改成相对路径String fileName = "\upload\"+smartFile.getFileName();
     saveAs的时候加上常量 smartFile.SAVEAS_VIRTUAL和 也还是这个错误提示,又哪位达人帮帮忙啊,感激流涕啊!! 

解决方案 »

  1.   

    看样子错误没有出现在你给的这段代码里面阿,不过你还要检查一下你的代码 看看那里调用了File的构造方法File(String)和File类的exists()方法了,如果你没有调用,那就有可能是jspsmart的问题了。
    The constructor File(String) is undefined 
    File(String) 构造方法没有定义
    The method exists() is undefined for the type File
    exists()方法在File类里面没有定义。
      

  2.   

    我的代码就上面这些,没有调用java.io.File,简直就是晕了菜了,我都换了三个jspsmart了,把这段代码放到JSP里,后来又放到servlet里 ,反复测,都不行,就差把jspsmart给反编译了跟踪了
      

  3.   

    看了看com.jspsmart.upload.File的Javadoc,确实没有那个构造方法和exists()方法,改用别的类库好了,看来也不怎么smart, 而且查了查这个jspsmart已经没有了支持了。