1. 在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>
    
  2. 代码中获取项目路径的方式

          String rootPath=System.getProperty("rootpath");
    

小弟最近正在写的一个工具类网站有兴趣的朋友看看 EasyPicker

相关文章:

  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-11-18
  • 2021-12-08
  • 2021-07-24
  • 2021-06-22
猜你喜欢
  • 2022-02-07
  • 2021-10-28
  • 2022-12-23
  • 2021-09-06
  • 2021-08-11
  • 2021-12-10
相关资源
相似解决方案