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 do you pre initialize servlets in a webcontainer?

 
shankhas sanyal
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
recently i attended an interview and the interviewer asked me :

How do you pre initialize servlets in a webcontainer?

Can anybody please help me find the answer?

Thank you!

Shankha
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can declare initialization parameters in web.xml of your web application. You can use that initialization information to initialize your servlet in the init() method of the servlet!
 
shankhas sanyal
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:You can declare initialization parameters in web.xml of your web application. You can use that initialization information to initialize your servlet in the init() method of the servlet!


Oh wow! That's so cool! thanks!!
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are Welcome!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are going to be working with servlets, it'd be a good idea to read through the Servlet Specification to learn things such as this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic