aspose file tools*
The moose likes Struts and the fly likes counting number of hits in a webapplication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "counting number of hits in a webapplication" Watch "counting number of hits in a webapplication" New topic
Author

counting number of hits in a webapplication

Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi All,

I have an a applicaiton developed in struts having ten pages and users will open any of these ten pages there is no login required, user can open either first or last depends on his requirement. I want to count number of user hits to this application.

where can place counting logic for this applicaiton, can any one give me any clue.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688

If you are using Struts 2.0 then Interceptor will help you to solve your problem. Or filter will also use for your requirement..


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
nishan thanks for you reply...

I am using struts 1.2
Teresa Lee
Greenhorn

Joined: Feb 01, 2008
Posts: 24
use plugin and do the count logic in the init() and destroy() method or you can write a java class to implements ServletContextListener.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9304
    
  17

You can use a filter as Nishan suggested. That's the easiest way I think...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
nishan/ankit

If I will use more than one filter where can I do count for single filter we can count in init() as you mentioned, but I want to count globally, can any one give any suggestions.

as lee told

we can implements ServletContextListener, i think this is also good approach.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Teresa Lee wrote:use plugin and do the count logic in the init() and destroy() method or you can write a java class to implements ServletContextListener.

In Struts 1 there's only one action created per action mapping, so init() and destroy() will almost never be called.

It could also be handled in a request processor extension.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: counting number of hits in a webapplication