Spring MVC中獲取當前項目的路徑
-
在web.xml中加入以下內容
<!--獲取項目路徑--> <context-param> <param-name>webAppRootKey</param-name> <param-value>rootpath</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.WebAppRootListener</listener-class> </listener> -
代碼中獲取項目路徑的方式
String rootPath=System.getProperty("rootpath");
小弟最近正在寫的一個工具類網站有興趣的朋友看看 EasyPicker
