• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating Hit counter  RSS feed

 
Mejo Cherian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi how i can create a hit counter using jsp?
 
Scott Selikoff
author
Bartender
Posts: 4087
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quick comment- there are many hit counters out there, you might try using one of them or finding freeware code.

That said, you need some kind of storage for the counter to keep track of the hits. I suggest a database although there are many other solutions. You can then use JDBC to update the counter anytime someone has visited the site, as well as store tons of other information about the user's visit such as unique hits per IP address versus total hits overall.
 
Mejo Cherian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a doubt. How we identify a user is visited our page? Is it done using cookies?
[ November 03, 2005: Message edited by: Mejo Cherian ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mejo Cherian:
Hi, i have a doubt. How we identify a user is visited our page? Is it done using cookies?

[ November 03, 2005: Message edited by: Mejo Cherian ]


Yes, cookies are commonly used to help the server recognize browsers that have already been to a given page.
 
Scott Selikoff
author
Bartender
Posts: 4087
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, that brings up the whole 'client side' state management versus 'server side' state management. In the case of a counter, I wouldn't use client side management since the user could delete the cookie (or disallow setting the cookie) and appear to visit a page hundreds of times, where all you cared about was unique visitors to a site.

Although there is the problem of multiple users sharing the same IP that could mask hundreds of users visiting the same page as the same user.

Clearly, there are more advanced issues here. I still recommend delegating to a pre-existing solution following the old adage "Good developers write good code, Great developers steal good code." Of course, I do not condone stealing .
 
Mejo Cherian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose that the user deletes the cookie, then if we are using cookies for hitcounter ,our aim to maintain the actual number of viewers of the page become not a true value. How we achieve this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!