遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

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目录)

   DiskFileItemFactory factory = new DiskFileItemFactory();
   File tempDir=new File("uploadtemp");
   if(!tempDir.exists()){
    
    tempDir.mkdirs();
   }
   factory.setRepository(tempDir);
View Code

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

posted on 2013-06-28 15:01  遗忘海岸  阅读(3506)  评论(0编辑  收藏  举报