You could roll your own or you could use whatever access-logging features your app-server provides.
The access logs tend to have a lot more information than you really need but, thankfully, there are plenty of products out there, such as WebTrends, that can parse this file and return readable results.
Tomcat, for instance, shipps with an access log valve which can be turned on by uncommenting it's entry in server.xml.
Add a static hit counter to your servlet. Create a couple of methods, one that increments the static counter then stores that value to a simple text file, and second method that reads the simple text file (for this example let's call the text file hits.txt).
On your servlet init method, determine whether or not the hits.txt file exists, if it does, initialize your static counter to the last value stored in your hits.txt file.
Once the servlet has been initialized, you simply increment your static counter and update your hits.txt file for each thread that enters your servlet (you should enclose this functionality within a synchronized method).
Throughout your servlet, keep thread synchronization in mind when dealing with your static counter.
Hope this helps.
Mike Cronin Data On Call
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com