File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes No of Times a URL is Hit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "No of Times a URL is Hit" Watch "No of Times a URL is Hit" New topic
Author

No of Times a URL is Hit

m sandeep
Greenhorn

Joined: Jan 24, 2011
Posts: 17
Hi Everyone

I looking of how to count the no hits my URL is having per day.

My application is purely struts based.

Please tell me a way or an idea .

I did little RND on interceptors but the problem to access my application i need to give the full URL. I mean if i give
http://localhost:10000/sandeep/sandy/Login.jsp only then i am able to access my application since it is pointing directly to the Jsp page not going to any action class file i am not able to keep a track of it .

please tell me ways in which i can keep a count the no of hits my URL is having per day

Looking forward for your reply
Thanks
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

In servlets we can achieve this using filters in struts2 use interceptor.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
m sandeep
Greenhorn

Joined: Jan 24, 2011
Posts: 17
HI

thank you for your reply

Actaully the application Url as you can see hits driectly the jsp page instead of some action class so in this situation can you tell me how to use interceptors.

As far as i know interceptors can only be used before an action class is called or after an action class is called but in my application there is no action class called when the url is hit

thanks
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi sandeep,

if the jsp page is hit, then i would suggest that use

in this way "hitcount" action will be invoked. Now use interceptor to meet your requirements.

hope this would help you.

m sandeep
Greenhorn

Joined: Jan 24, 2011
Posts: 17
As you told that "if the jsp page is hit, then i would suggest that use
view plaincopy to clipboardprint?
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=hitcount">

in this way "hitcount" action will be invoked. Now use interceptor to meet your requirements. "

How would it call the struts-config.xml file to look for the hit count action class???

will this be an issue when the page is loaded i mean to say will this call interuption when there are too many users accessing the site

looking forward for your reply
thanks
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi there,

ok i got it, you are not using struts2, so there is not point of using interceptors,
you can use filters for struts1.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No of Times a URL is Hit