I am developing dynamic web application using JSP and servlet. One of the methods is to read CSV file. I have done code for reading contents from CSV file. The contents are printed on console, I want this console's output on the web application's window. How can I do it?
Asked
Active
Viewed 347 times
-1
-
Please share the code where you are reading the file and printing it to the console. – Nishesh Pratap Singh May 19 '17 at 05:57
-
There are multiple types of logs, which console displays, do you want custom logs that is ones from System.out.print on the browser or something else – Saurabh Jhunjhunwala May 19 '17 at 05:58
-
yes from System.out.print, printing on the console and want this output to display on browser – Dip May 19 '17 at 06:51
2 Answers
0
Writing This Code,you can print message in browser.
PrintWriter out = response.getWriter();
out.println("message");

Sanjay
- 2,481
- 1
- 13
- 28
-
where to write it, Is in servlet where im calling Read method to read csv? – Dip May 19 '17 at 09:01
-
@Dip See how to redirect the stream with [Redirect System.out.println](http://stackoverflow.com/questions/3228427/redirect-system-out-println) to use the `response` writer. This should be done at the beginning to send every `System.out.printxxx` message in the response stream. From there, not sure how to access them yet ;) – AxelH May 19 '17 at 10:44
-
-1
use Table tag in jsp . In th put your header name and in Td print your data using loop <%=Your data%>.

dron
- 1
-
can you please explain in detail..However I dont want to display it by hardcoding..I want to call that output data from console to browser. – Dip May 19 '17 at 06:55
-
OP want a way to print the value of the output stream into his page. Not some specific instance – AxelH May 19 '17 at 10:42