由于最近使用 request.getRealPath 该方法已经不推荐使用了
request.getRealPath 的替代方法
request.getSession().getServletContext().getRealPath(File.separator)
如 request.getSession().getServletContext().getRealPath(File.separator) 得到项目的绝对路径如:
D:\tomcat\apache-tomcat-7.0.47\wtpwebapps\project\
request.getSession().getServletContext().getRealPath(“path”) 得到项目的绝对路径:
D:\tomcat\apache-tomcat-7.0.47\wtpwebapps\project\path\