문제

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....

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top