獲取專案根目錄和tomcat路徑
阿新 • • 發佈:2019-01-09
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("/")