获取项目根目录和tomcat路径

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

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

2.获取tomcat的路径

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

猜你喜欢

转载自blog.csdn.net/tianxian730/article/details/80605903