I am just curious to know, what happens when System.out.print() is called in a servlet?
Where does it write the text?
Or is there any significant use of System.out in a servlet?
I am just curious to know, what happens when System.out.print() is called in a servlet?
Where does it write the text?
Or is there any significant use of System.out in a servlet?
No, there is any significant use of System.out in a
servlet
. Beacause , Servlet is a web technology for generating dynamic web pages. Normally , it returns response toHTML
page. So, there is no need for print data onConsole
.For Console print, there are many other options except
Servlet
. But still if we want to print data on console then you can write insideservice(),doGet(),doPost()
and other methods also :-But, it is recommended to avoid that.
It depends on your servlet container.
For Tomcat :
For jetty, you can redirect standard output to a file :
System.out.print() writes on
Server Console
.It will write in the console .System.out is generally used in servlet to verify some piece of code is working,which we can refer in console.