String realPath = req.getServletContext().getRealPath("/"); String realPathParent=(new File(realPath1)).getParent();
获取的realPath->tomcat/webapps/zz
获取的realPathParent->tomcat/webapps