This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

index.html hits my servlet!  RSS feed

 
LiL Kunji
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!