标签:pat 目录 class text servlet this tomcat tco pac
1.发布到tomcat后获取应用的根目录
ServletContext s1=this.getServletContext();
String temp=s1.getRealPath("/");//C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\demo1\
String temp=s1.getRealPath("/WEB-INF/classes/log4j.properties"); //C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\demo1\WEB-INF\classes\log4j.properties
标签:pat 目录 class text servlet this tomcat tco pac
原文地址:http://www.cnblogs.com/tiancai/p/6036027.html