Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes how can i identify whether it is fitst request or second request and so on Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how can i identify whether it is fitst request or second request and so on" Watch "how can i identify whether it is fitst request or second request and so on" New topic
Author

how can i identify whether it is fitst request or second request and so on

chandra kunchala
Greenhorn

Joined: Aug 06, 2008
Posts: 17
HI ALL

init() method will be called by two ways
one is during server start up if we specify <load-on-startup> in web.xml
and second is during the first request right?

if iam right, can you tell me how can i identify that whether it is first request or second request and so on.



regards
CHANDRA SCJP 5.0 97%


Thanks & Regards
Chandra SCJP5.0
sangram mhatre
Greenhorn

Joined: Apr 02, 2005
Posts: 15
You can store the value in an attribute in ServletContext object and in each of the service method , extract this value and increment it and again
store in same attribute .
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You question is a little unclear to me.

Are you asking how to tell if a request from a user is his/her first or second or are you asking how to tell whether a servelet was brought into service as a result of a load-on-startup directive or as a result of the first hit to it?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can i identify whether it is fitst request or second request and so on
 
Similar Threads
General Query on HTTP request generation
Session Invalidate
WebServices - How it is working
how to handle session in EJB
Difference between WML and XHTML