I have a method in a Java class that I would like to use to write to a text file which is located in my WEB-INF dir. I think I am having trouble getting the correct path for this file. I am calling the method in my Servlet and using Servlet Context in order to get the path but I have yet to write anything to the text file. Here is my code
It will, but is unmaintainable. Writing it somewhere outside the web app ail also "hide it" from the user.
Joined: Nov 23, 2012
So do you suggest that I have a folder outside the WEB-INF that is dedicated to my .txt file? Can I put the .txt file in the same folder as my Bean or Class? Do I still need to use the getServletContext() in my Servlet?