This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi, have an integer (say counter = 0) declared in your Servlet class. in doGet() or doPost() increment the counter. and while sending the response out.println("so far" + count + "visits were made to this site"); sri
Hmm. That will tell you how many have visited so far, but not how many are 'visiting' now. The latter is actually very difficult to figure out. Say someone requests a page from your site. Do you assume they are actually reading it? A server can't tell if someone types in another URL to their browser to get a page frmo another site. A browser can't tell if a user walks away from the computer, or does something else completely. Is that what you are trying to find out?