File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes index.html hits my servlet! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "index.html hits my servlet!" Watch "index.html hits my servlet!" New topic
Author

index.html hits my servlet!

LiL Kunji
Greenhorn

Joined: Jun 23, 2001
Posts: 26
hi. my question is how do i configure web.xml or tomcat so that when my index.html page is hit my hitcounter servlet is hit. i don't want a free one and i don't want any images on my website so i don't want jsp. this is just a simple count of how many times index.html(static page) is hit and i will save in a txt or database. thank u
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Just make some sort of index Servlet that does the counting, then redirect to the index.html page
Or even better: always use the welcome servlet the requested page, so you can also count reloads.
What you basicly have to do is thus making the servlet the index page ...
BTW, I think you've got something wrong about JSP ... Actually JSPs and servlets are exeactly the same when executed ... The JSP/Servlet engine first transforms a JSP into a servlet, compiles it and then uses it ... or I just misunderstood your line about the jsp and the image ...
Regards,
G´┐Żnther
http://www.javacoding.net
LiL Kunji
Greenhorn

Joined: Jun 23, 2001
Posts: 26
thanks for responding. i didn't quite understand but i have tried sendRedirect("/index.html") with the hit servlet being what is first hit but i did not have it set up right because it was an infinite loop. could u elaborate plz? i could turn my entire home page into a template but then that would leave all the links screwy to the rest of my static pages which i could go in and fix everyone of them but there should be a way to just have the servlet hit while my index.html is hit. i am playing with the filter technique so maybe this will do it. anyhow if u have more suggestions i am open. thank u. btw the redirect method seems to be the best way if i can just keep it from looping (just set up where the hit servlet is the first "thing" hit then just sendRedirect("index.html") and it is done.
 
Consider Paul's rocket mass heater.
 
subject: index.html hits my servlet!