Created
February 16, 2012 09:56
-
-
Save wendal/1843735 to your computer and use it in GitHub Desktop.
获取项目根路径的简单方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import javax.servlet.ServletContextEvent; | |
import javax.servlet.ServletContextListener; | |
public class XServletContextListener implements ServletContextListener { | |
public static String ROOT; | |
public void contextDestroyed(ServletContextEvent event) { | |
ROOT = event.getServletContext().getRealPath(File.separator); | |
} | |
public void contextInitialized(ServletContextEvent arg0) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment