Weblogic的中的文件上传

在weblogic中在jsp页面中this.getServletContext().getRealPath("/upload")这样的写法是要报错的
在jsp页面总你甚至不能使用this.getServletContext(), 而在servlet中.getRealPath("/") 返回的是null

用下面的语句可以在F:\Oracle\Middleware\user_projects\domains\base_domain下创建uploadtemp目录
(在eclips调试环境中中,改语句会在eclips.exe同级目录下建立uploadtemp目录)

Weblogic的中的文件上传
   DiskFileItemFactory factory = new DiskFileItemFactory();

   File tempDir=new File("uploadtemp");

   if(!tempDir.exists()){

    

    tempDir.mkdirs();

   }

   factory.setRepository(tempDir);
View Code

使用
File saveDir;
saveDir.getAbsolutePath();
可以获取对该目录的引用

你可能感兴趣的:(weblogic)