Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is running a servlet from the startup script possible

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run the startup script I would like to run a servlet that would set up a number of connections to a database.
So when the web application is up and running I would already have stored a number of database connections in the servlet contex.
Is this possible or can I only run a servlet when the web application is up and running.
What I am trying to achieve is with the connections established when someone l;ogs in they dont have to wit for the servlet to connect to the database.
Thanks for any help.
Tony
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the init() method of the servlets to set this up. The init() is called when the web application is first loaded, so by the time a request is actually handled, everything can be ready to go -- nice and fast.
 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nathaniel, got it working.
Cheers Tony
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My pleasure, Tony. How about putting me on the payroll? :roll:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic