Reputation: 593
I am new to servlet world.. I want create a file inside WEB-INF (or WEB-INF/some_folder) folder from servlet. and this should be done at server-startup. Please let me know how can it be done.
Thanks in advance.
Upvotes: 1
Views: 3869
Reputation: 2014
Point: you can access files from servlets but cant access them from web container
String filename = "/WEB-INF/somefile.xml" ;
ServletContext context = this.getServlet().getServletContext();
String pathname =context.getRealPath(filename);
Upvotes: 2