how can i call html file in a servlet? I want to read the html content stored in a file and want that as a servlet output. How should I do it? Thanks
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
If you want to get all the contents of the HTML file, why not just use the include() method in the RequestDispatcher interface? Is there something you are trying to gain by reading the file in and writing it back out?
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I want to get the contents of the file (which is a part of the HTML file, that was generated by parsing the XML document) and redirect to the brower. ie out.println("<html>"); out.println("<body>"); : : //here read the contents of the file.html, which contains a html //table, redirect that content to the browser : : out.println("</body>"); out.println("</html>");
I tried, response.sendRedirect("c:\file.html"); It is just displaying the contents of file but not the other html tags which I have written before and after I read the file. How do you use RequestDispatcher, please give me some pointers... Thanks
maha anna
Ranch Hand
Joined: Jan 31, 2000
Posts: 1467
posted
0
Jairat, I use it like this.
I responded to your another post of same question. Which approach are you going to take. This ,.include technique also would work. regds maha anna
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.