Fork me on GitHub

String filePath = request.getSession().getServletContext().getRealPath("/");这句话返回的路径是什么,解释下getRealPath("/")函数中的"/"表示什么意思

request.getSession().getServletContext() 获取的是Servlet容器对象,相当于tomcat容器了。getRealPath("/") 获取实际路径,“/”指代项目根目录,所以代码返回的是项目在容器中的实际发布运行的根路径如:I:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\UMPWeb_20131230\

posted @ 2015-04-22 13:31  ZZZZW  阅读(2495)  评论(0编辑  收藏  举报
AmazingCounters.com