Start by defining what a "visitor" is. It's easy to count how many sessions get created - if your web app creates a session for every visitor. It's also easy to count how many times a particular web page is accessed - but each visitor might access a particular web page more than once. So think about what you want to count as a "visitor".
It's a very open ended question.
Now if you say you just want the counter, define a static variable and keep on incrementing that variable. But if you go via this approach then you will have to take care of the IP addresses from which the request is coming.
The reason that I am saying about the IP addresses is say you hit the index.jsp from your machine 10 times then that should not increment the counter to 10. Perhaps you can look at Google Analytics.
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
subject: How to find number of visitors for my website?