This counter uses MS SQL Server to store hits. I have used a custom stored procedure to add and display hit. This is a very good example using stored procedures with JSP.
CounterServlet is a servlet that maintains a counter for individual web pages. Web pages hitcount is displayed by invoking the CounterServlet as a server-side-include.