jsp获取项目的物理路径: 

 String path = application.getRealPath("/");

效果如下:

java类与jsp文件获取项目物理路径

java类文件获取物理路径:

ServletContext context = ServletActionContext.getServletContext();

String path = context.getRealPath("/*");

 

相关文章:

  • 2021-11-29
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2022-02-07
  • 2022-02-07
  • 2021-07-25
  • 2021-11-30
  • 2021-11-30
相关资源
相似解决方案