How to get path inside folder project in java spring mvc

时间:2017-11-13 06:30:15

标签: java spring spring-mvc tomcat

I try to make web apps using java spring MVC.

I set my project folder on D: and the tomcat on C:.

I want to set the path folder for the upload purpose using this code :

String absoluteFilePath = request.getServletContext().getRealPath("/WEB-INF/uploads/");

but the file always set on tomcat, not on project folder. please help me

1 个答案:

答案 0 :(得分:0)

Your Context is always set where your project is deployed thats the reason it is always set on Tomcat. if you want to set any other folder then please use Java File Handling. For Taking Path Dynamically you can use Java Environment Variable as well.