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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:20:56+00:00 2026-06-10T00:20:56+00:00

Until now I used to think that a web-application can have only one dispatcher-servlet

  • 0

Until now I used to think that a web-application can have only one dispatcher-servlet which we define in web.xml

  • Am I right in thinking so?
  • Can i have multiple dispatcher servlets in a single web application? If yes, How?
  • What is a situation we might need this in?
  • Can there only be a single application context in the entire web application?
  • How can we define multiple application contexts?
  • Can a dispatcher-servlet exist in a non-spring application?
  • 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-10T00:20:58+00:00Added an answer on June 10, 2026 at 12:20 am

    Can you have multiple dispatcher servlets in a single web application ?

    Of course, quoting the official documentation (bold is actually there as well!)

    A web application can define any number of DispatcherServlets. Each servlet will operate in its own namespace, loading its own application context with mappings, handlers, etc. Only the root application context as loaded by ContextLoaderListener, if any, will be shared.


    How?

    Just declare several servlets with different names but using org.springframework.web.servlet.DispatcherServlet class. Also make sure yourServletName-servlet.xml file is available.


    What is a situation we might need this in ?

    DispatcherServlet is very flexible. Not only Spring MVC uses it, but also Spring WS, Spring support for hessian, etc.


    Also, can there only be a single application context in the entire web application ?

    Answered already, also in the quoted documentation: one application context per DispatcherServlet + one main web application context.


    How can we define multiple application contexts ?

    See above, just create multiple DispatcherServlets.


    Can a dispatcher servlet exist in a non-spring application ?

    DispatcherServlet is a Spring context (Spring application) on its own, thus: no. On the hand DispatcherServlet can be declared in an application not having parent (main) application context, thus: yes.

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

Sidebar

Related Questions

Untill now in C# MVC3 i only had to use one controller which used
I've a web page that that can be used to upload files. Now I
Up until now I used DateTime.Now for getting timestamps, but I noticed that if
I im developing a web application, its a servlet which basically acts as a
I have used mnesia for a while now. I have to confess that i
Ok so I have worked and used my global variables until now, and it
Up until now we used Ant in my company. Whenever we wanted to send
Until now I've always used the ASP.NET MVC framework source for debugging ASP.NET MVC.
Until now I've been used to using DAOs to retrieve information from databases. Other
Until now I've been only writing console applications but I need to write a

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.