获取项目路径


 获取项目路径
1.this.getClass().getClassLoader().getResource("/").getPath();
 getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
 2.req.getSession().getServletContext().getRealPath("/resources/upload");
 3.servletContext.getRealPath("/").substring(0, servletContext.getRealPath("/").lastIndexOf("seawin-webapp-base"))

posted @ 2017-10-19 15:41  轻尘如风  阅读(135)  评论(0编辑  收藏  举报