1.http://xxxx.com/demo获取/demo
ServletContextEvent.getServletContext().getContextPath()或request.getContextPath()
2.获取tomcat的路径
ServletContextEvent.getServletContext().getRealPath("/")
1.http://xxxx.com/demo获取/demo
ServletContextEvent.getServletContext().getContextPath()或request.getContextPath()
2.获取tomcat的路径
ServletContextEvent.getServletContext().getRealPath("/")