获取webRoot路径的方法

String webRootPath=request.getSession().getServletContext().getRealPath("/");
 webRootPath

    String uploadPath="download\dadan\";
            //uploadPath附加传入的路径,组成一个上传的完整路径
            uploadPath=webRootPath+uploadPath;

原文地址:https://www.cnblogs.com/hmpcly/p/9488613.html