My servlet lets user upload a file, I've created a button to view the uploaded file.
now, on click of that button I want the uploaded file to open. How do I do this on the JSP side or servlet.java side?
it is located in WEB-INF/Uploads/my.txt folder.
=====================================EDIT=========================================
Based on answers below, I've modified my code and I'm pasting the same here for more answers,
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
ServletContext context = getServletContext();
String path = context.getRealPath("/u/poolla/workspace/FirstServlet/WebContent/WEB-INF/Uploads/Config.txt");
FileReader reader = new FileReader(path);
BufferedReader br = new BufferedReader(reader);
String firstline = br.readLine();
System.out.println(firstline);
}
PS: This is not working, still looking for answers. Thank You!