• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

counting number of hits in a webapplication

 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Struts 2.0 then Interceptor will help you to solve your problem. Or filter will also use for your requirement..
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nishan thanks for you reply...

I am using struts 1.2
 
Teresa Lee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a filter as Nishan suggested. That's the easiest way I think...
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic