jsp后台获取项目路劲

web.xml

里配置

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>bookdir</param-value>
</context-param>

在方法里获取
String pathUrl = System.getProperty("bookdir");
原文地址:https://www.cnblogs.com/liuyuanchen/p/12696983.html