1.web项目中获得tomcat bin目录的路径,并获得webapps的路径
String path = System.getProperty("user.dir");//tomcat bin路径
path = path.substring(0,path.indexOf("bin"))+"webapps\\upload";
2.web项目中获得项目的跟路径,项目的绝对路径
String path2 = request.getSession().getServletContext().getRealPath("");//项目根路径