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 8590907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:24:11+00:00 2026-06-11T23:24:11+00:00

In one of the code i saw that, there was no <servlet-mapping> tags and

  • 0

In one of the code i saw that, there was no <servlet-mapping> tags and only its declared as below

<servlet>
    <servlet-name>startServlet</servlet-name>
    <servlet-class>com.login.StartupServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

can this work without <servlet-mapping> and work on <load-on-startup>1</load-on-startup>??

This servlet will get loaded on server startup to connect to DB and do few operation on caching.

PS: this is on Servlet 2.0+ version and not annotated.

thanks
Punith

  • 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-06-11T23:24:12+00:00Added an answer on June 11, 2026 at 11:24 pm

    The code you posted defines something you might call an “initializer Servlet”. It is not directly accessed from the outside world (using an URL) but it will be started by the Servlet container.

    It is valid but it can’t be accessed by the clients. It’s often used for initialization purposes. You can access servlets without <servlet-mapping> using Servlets 3.0 annotations.

    Mind that <load-on-startup> doesn’t hold true/false value (0/1) but it defines an integer which is an order of startup. Higher number means that the Servlet will be loaded after the ones with lower number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was looking an old project and i saw one code there that I
is there any development environments that allow you to have one code base that
In code one can specify globally accessible constants/enums/etc once that can then be reused
This works when I have only one state code as a parameter. How can
I saw that there's many, many thread about this on the web, also in
I'm a student, have a test tomorrow, and I saw that last year there
I saw that there were many problems regarding notifyDataSetChanged(). I've looked through many of
I am not exposed to Spring as yet. I saw the below code in
I've inherited some python code that writes a new '/etc/udev/rules.d' mapping file and then
I have 3 different jquery uses & put it into one code as follows:

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.