web项目获取当前tomcat webapps目录

String directory = NoScanAction.class.getClassLoader().getResource("").getPath();

 

String rootPath1 = ServletActionContext.getServletContext().getRealPath("/");
String path = rootPath1.substring(0, rootPath1.indexOf("webapps")) + "webapps/upload/";

posted @ 2020-03-18 16:23  月亮那么僵  阅读(1789)  评论(0编辑  收藏  举报