获取Web项目路径

论坛 期权论坛 脚本     
匿名技术用户   2020-12-27 19:58   308   0
public class ApplicationListener implements ServletContextListener {
public static String WEB_PATH = null;
public void contextInitialized(ServletContextEvent sce) {
String webPath = sce.getServletContext().getRealPath("/");
ApplicationListener.WEB_PATH = webPath;
System.setProperty("PROJECT_LOG", webPath);
System.setProperty("WEB_PATH", webPath);
LogUtil.init(webPath + "/config/log4j.xml");
}

public void contextDestroyed(ServletContextEvent sce) {

}
}



分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP