String directory = "/upload";
String targetDirectory = ServletActionContext.getServletContext().getRealPath(directory);
targetDirectory 路径是指eclipse 工作目录下
*\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\Exercise\upload
若是发现路径中包含了web服务器的路径,那你就要采用截串的办法,将路径定位到相对路径下。