首页 > 代码库 > jsp发布后应用根目录

jsp发布后应用根目录

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

jsp发布后应用根目录