如果你使用的是你自己下载的tomcat,那么无论做什么都无法把上传的文件保存在项目中。

String classPath = this.getClass().getClassLoader().getResource("/").getPath();
String path=request.getSession().getServletContext().getRealPath("/upload/");
String paths=System.getProperty("user.dir");

这三个都不可以,指向的都是你自己下载的tomcat里面的webapp文件夹而不是你的idea项目

idea项目中保存文件

改这个output directory也没什么用

解决办法:老老实实用maven-tomcat插件吧。

相关文章:

  • 2021-06-28
  • 2021-09-15
  • 2022-01-01
  • 2022-01-22
  • 2021-10-19
  • 2022-12-23
  • 2021-11-06
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
  • 2022-03-05
  • 2021-09-11
  • 2022-12-23
  • 2021-06-08
相关资源
相似解决方案