This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet count Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet count" Watch "Servlet count" New topic
Author

Servlet count

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
Can i keep track of how many times a servlet is invoked??
If i have todo some initialisation if the servlet is invoked for the first time ,then how can i do it.
Thanks,
Raju
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20494
    ∞

I do this as sort of a debugger. All you need to do is make a claas attribute called count and in your doGet put count++; count now hold the number of hits.


permaculture Wood Burning Stoves 2.0 - 4-DVD set
tony.b
Greenhorn

Joined: Mar 02, 2002
Posts: 4
Hi raju,
If you want to do some sort of initialization when servletis invoked for the first time, then you have to override init() or init(ServletConfig) method. If you will override simple init() then you don't need to worry about servletConfig object. If you will override init(ServletConfig) then you have to save that parameter or just call super.init(ServletConfig) by passing the object which you got.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet count
 
Similar Threads
JSP servlet bean bad communication
Passing values from forms..
applet to servlet communication
Sharing variables between servlets
passing parameter from jsp to servlet