jiangfeilong

得到web项目的根目录路径

System.getProperty("user.dir")//
String path = this.getServletContext().getRealPath("/WEB-INF/order_form.html");

String appPath = filterConfig.getServletContext().getRealPath("/"); //得到根目录路径

 

得到类所在的路径

FormServlet.class.getClassLoader().getResourceAsStream("FileName");//可以直接读取文件

 

分类:

技术点:

相关文章:

  • 2021-11-27
  • 2021-07-29
  • 2021-08-22
  • 2022-12-23
  • 2021-12-19
  • 2021-05-31
  • 2021-11-25
猜你喜欢
  • 2021-12-19
  • 2022-12-23
  • 2021-05-05
  • 2022-02-22
  • 2021-04-23
  • 2022-12-23
  • 2022-01-19
相关资源
相似解决方案