获取项目根目录和tomcat路径

1.http://xxxx.com/demo获取/demo

ServletContextEvent.getServletContext().getContextPath()或request.getContextPath()

2.获取tomcat的路径

ServletContextEvent.getServletContext().getRealPath("/")

你可能感兴趣的:(获取项目根目录和tomcat路径)