Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6139195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:57:32+00:00 2026-05-23T17:57:32+00:00

When we mention any servlet as loadOnStartup in web.xml then its init method is

  • 0

When we mention any servlet as loadOnStartup in web.xml then its init method is called for sure. Just wanted to confirm does service and destroy methods are also get called or not? If not when they get called?

Another question is as it is mentioned every where init method is called only once. Does that mean when the servlet gets the request first time, init method will be called and then service will be called.

But destroy will not be called. When the second request it will simply call the service method again but not init method. Is this understanding correct? But when container decides to call the destroy method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:57:33+00:00Added an answer on May 23, 2026 at 5:57 pm
    • loadOnStartup means that the servlet will be loaded (and its init(..) method called during container startup. Otherwise, as you suspect, it will be loaded when the first request comes
    • containers have only one instance of each servlet. When they create it, they call init(..). When the context is undeployed (for example – the container is stopped), destroy() is called
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is something I've always wondered, and I can't find any mention of it
I dont see any direct mention on using multiple slugs (or any behavior for
I have heard mention that some desktop applications are pretty much just wrappers for
NOTE : I mention the next couple of paragraphs as background. If you just
I can't find any setImage method. Using Zend Framework 1.10.2 (1.10.3 was released today,
I'm building a relatively simple web-app where the main servlet implements the ServletContextListener interface
I've been looking through the reference docs and can't find any mention of a
https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Arrays.html Sun does not mention any complexity for their binary-search implemention. Is this a
I read this question/answer however there wasn't any mention of it being a "bad
Help appreciated. Couldn't find any mention of this in the book (k&r).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.