I have this code with me, I want to implement Page Visit Count. I have declared one context param value in web.xml file with param-name:pageVisitCount, but my code is not functioning. Where am I doing wrong.....if this code is not modifying my context parameter value, then how can I achieve it...?
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class VisitCount extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
response.setContentType("text/html") ;
PrintWriter out = response.getWriter() ;
String pageVisitCount = getServletContext().getInitParameter("pageVisitCount") ;
int x = Integer.parseInt(pageVisitCount) ;
x = x+1;
boolean bol = getServletContext().setInitParameter("pageVisitCount",""+x) ;
out.println("Page Visit Count : "+getServletContext().getInitParameter("pageVisitCount") + " "+bol) ;
}
}