Actual Tomcat path to create a new file

If I create a new file on the JSP page that only gives it a name, it is created in the / bin directory of the TOMCAT folder, and not in the same .jsp folder.

I'm not sure why this is happening, it seems not intuitively.

+3
source share
1 answer

It is definitely intuitive, since the current directory of the running process is the bin folder.

You can try something like:

ServletContext context = session.getServletContext();
String realContextPath = context.getRealPath(request.getContextPath()); 
+2
source

Source: https://habr.com/ru/post/1762993/


All Articles