在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);
使用
File saveDir;
saveDir.getAbsolutePath();
可以獲取對該目錄的引用