Title: Counting hit rates from servlet more accurately!!
hi,
when someone first enters your site he doesn't have a session, you increment the counter, add a session to the request. the trick is that only users that don't have a session make the counter increment.
in your servlet you'd do sth like this:
 
static int counter =0;
 
public void service(...) {
    HttpSession sess =null;
    if ((sess = req.getSession(false)) != null) {
        // user has already a session --> has already incremented the counter
    } else {
        counter += 1;
        sess = req.getSession(true);    // add session to req
    }
}
 
hope this helps.
 
-mw
 
 
----- Original Message -----
Sent: Monday, October 22, 2001 6:42 AM
Subject: Counting hit rates from servlet more accurately!!

Hi Group

I have a servlet customized which does some kind of monitoring page hits and storing  it to a database(coolservlets.com).My issue is the servlet increments the counter for a 'refresh' of the site as opposed to increment for a new browser session as is the case with available free counters (thecounter.com)

I've gone through an article in webmonkey about tracking but doesn't seem to provide any details.

Since I am unable to think complex in java I'll be happy           
If someone could help me with sources for me to analyze.

Thanks
TIA
Rizwan





_______________________________________________
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: [EMAIL PROTECTED]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/web400
or email: [EMAIL PROTECTED]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

Reply via email to