3

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

3
  • What do you mean with "console". NB has an Output window (Ctrl-4), where the message should appear. Commented Jun 15, 2011 at 9:02
  • yes but it is not showing the System.out.println() output Commented Jun 15, 2011 at 11:29
  • Did you try System.err.println ? What is about to upgrade to Netbeans 7.0 ? Commented Jun 15, 2011 at 13:45

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

are u seeing it in log of server
yes... of course.. if you cannot see it please go to Window->Services-> Servers and select and right click your server and "View Server Log"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.