Write a java program using servlet to count the no. of times has been invoked.


import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class HelloServlet extends HttpServlet

{

            int c=0;

            public void doGet(HttpServletRequest r1,HttpServletResponse r2)throws ServletException,IOException

            {

    r2.setContentType("text/html");

            PrintWriter pw=r2.getWriter();

            c++;

            pw.println("Servlet Is Invoked For ");

            pw.println(""+c + "Times");

            pw.close();

    }

}
Write a java program using servlet to count the no. of times has been invoked. Write a java program using servlet to count the no. of times has been invoked. Reviewed by on April 27, 2015 Rating: 5
Powered by Blogger.