Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
chandra kunchala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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%
 
sangram mhatre
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic