i have a servlet i want to see output on console,my servlet is running if i replace System.out.println with out.println
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet NewServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet NewServlet at " + request.getContextPath ()
+ " </h1>");
System.out.println("exit");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
the exit is not getting displayed on console. can anyone tell me the reason
I tried out your sample code, but its working well. And I used GlassFish as the server, so in the console it gives INFO: exit
as the result. I think your "exit"
text is not noticeable. Prefix your "exit"
with some "*"
marks and see....