getServletContext().getRealPath problem
Dear all,
I have the following servlet, but when I call getServletContext().getRealPath("/WEB-INF/data/data.txt"), it always return null. I am using Tomcat 4.0 to deploy my web application. I've also tried to use getServletContext().getRealPath("index.html"), which also returns null. Any one has an idea for this?
publicclass ServletTestextends HttpServlet{
private String fileName ;
publicvoid init()throws UnavailableException{
this.fileName = getServletContext().getRealPath(
"/WEB-INF/data/data.txt");
}
protectedvoid doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
System.out.println("fileName" + this.fileName);
}
}
Many thanks!

