Here is the my servlet class that is responsible to get the data from the HTML page and store that data in EmailList.txt file placed under WEB-INF directory:
Code Snippe
Right click on the file in eclipse an go to properties, you'll see that this is a different file.
Actually you should not try to write/create a file in such a location. Your application may not always be unpacked from a .war
archive, in which case ServletContext#getRealPath() will return null
.
An alternative would be to define a context init parameter in your web.xml and set a root for the file system that should be visible to your application
fsroot
E:\CodePractice
and to retrieve it anywhere (servlets/JSPs) in your application you can use ServletContext#getInitParameter(java.lang.String):
String path = getServletContext().getInitParameter("fsroot");