Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a hit counter in JSP.  RSS feed

 
Chaminda Bandara
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to get hit count using jsp code?










[BPSouther: Changed subject line from "pls help"]
[ June 07, 2007: Message edited by: Ben Souther ]
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You have to look at filters as I think the solution to keep track of
the hit counts.

Thanks,
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
UseAMeaningfulSubjectLine
and
UseRealWords
Abbreviations such as "u" or "ur" in
place of "you" and "you are" or "you're" confound language translation software making
it hard for our non-English speaking members to read your posts.
"plz" is not a word in the English language.

Again, welcome to JavaRanch and good luck with your question.
-Ben
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In regard to your question...
There are several ways to count hits and the numbers can vary greatly, depending on how you define a hit.

Using a filter, you can track every HTTP request to your site but that will probably not give you what your looking for since most pages are the result of many small HTTP requests (one for each image, css page, js page, etc...).

You should also decide if you want to count the number of times that people have accessed your site or if you want a separate counter for each page.

Do you want the counts to persist across restarts?
If so, you will need to store the data in either a file or a database.

Do you want the same user hitting the same page over and over to increment the counter each time or do you only want to count a user's first hit to your site. (A session listener could be useful in this case).

Another (and more useful IMHO) method of tracking usage is to turn on access logging at the server/container level and then run the access logs through one of the many (and free) analyzers out there like Webalizer.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben,

Nice description of the requirements of Hit counts. That is really
very informative.


Thank you very much!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!