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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:03:02+00:00 2026-06-09T08:03:02+00:00

What happens if I have two servlet mappings in web.xml that match a request?

  • 0

What happens if I have two servlet mappings in web.xml that match a request? Does it choose most specific?

For example if I have the following xml and a request comes to …./something while it go to somethingservlet or everything_else servlet?

   <servlet-mapping>
      <servlet-name>something</servlet-name>
      <url-pattern>/something</url-pattern>
  </servlet-mapping>    

  <servlet-mapping>
    <servlet-name>everything_else</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
  • 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-09T08:03:03+00:00Added an answer on June 9, 2026 at 8:03 am

    First succesful match will be used.

    There are certain mapping rules follwed by servlet container. Read Servlet 2.5 specification chapter SRV.11:

    The path used for mapping to a servlet is the request URL from the request
    object minus the context path and the path parameters. The URL path mapping
    rules below are used in order. The first successful match is used with no further
    matches attempted:

    1. The container will try to find an exact match of the path of the request to the path of the servlet. A successful match selects the
      servlet.
    2. The container will recursively try to match the longest path-prefix. This is done
      by stepping down the path tree a directory at a time, using the ’/’ character as
      a path separator. The longest match determines the servlet selected.
    3. If the last segment in the URL path contains an extension (e.g. .jsp), the servlet
      container will try to match a servlet that handles requests for the extension.
      An extension is defined as the part of the last segment after the last ’.’ character.
    4. If neither of the previous three rules result in a servlet match, the container will
      attempt to serve content appropriate for the resource requested. If a “default”
      servlet is defined for the application, it will be used.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions. 1) What does a constructor really do? What happens if
We have two applications running on single machine,one of which is web application that
I have two pages, on the first page after an event happens I change
Using oracle database. Here's how i think the SQLException happens... Say i have two
What will happen if i have two mirrors with same id in the settings.xml
Java 6 API question. Does calling LockSupport.unpark(thread) have a happens-before relationship to the return
I have a problem that happens in IE 8 and Firefox 6.0 but not
I have a property on a class that happens to be a Table<T> .
In jQuery, what happens when you have two .children() functions? var area = image.canvas.children('.image-pinpoint-edit').children('.image-pinpoint-edit-area');
I have two websites http://www.buywwetickets.com/ http://www.ufcticketbooth.com/ The problem is that sometimes before the websites

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.