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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:55:44+00:00 2026-05-21T11:55:44+00:00

I am confused about the way the DefaultAnnotationHandlerMapping works. In my web.xml I have

  • 0

I am confused about the way the DefaultAnnotationHandlerMapping works.

In my web.xml I have

 <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/somePath/someWork</url-pattern>

    <url-pattern>/users</url-pattern>
    <url-pattern>/user/*</url-pattern>
  </servlet-mapping>  

I have the controller like this,

   @RequestMapping(value="/user/adduser", method={RequestMethod.POST})
    public void addAdmin(@ModelAttribute("myData") myData data) {

        System.out.println("We reached adduser controller");

    }

And in the jsp file i have

<form:form id="adduser" method="post" action="/user/adduser" commandName="myData">

This does not work. I get the error no handler mapping found for “/adduser” and 404 for the page “/user/adduser”

But in the .xml file if i mention

  <url-pattern>/user/adduser</url-pattern>

it works, or if i make the controller like,

  @RequestMapping(value="/adduser", method={RequestMethod.POST})

also works. When submitting the page it reaches the correct controller.

I am now confused the way the @ReuqestMapping works. When a request comes like “/user/adduser” from where it will start looking for the right class and the right 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-21T11:55:45+00:00Added an answer on May 21, 2026 at 11:55 am

    Spring will match against the pathInfo property of the HttpServletRequest.

    If your web.xml specifies <url-pattern>/user/*</url-pattern>, then the pathInfo will be the path with the /user prefix removed, so the @RequestMapping has to be /adduser.

    If web.xml specifies <url-pattern>/user/adduser</url-pattern>, then the pathInfo will be the full /user/adduser path, so @RequestMapping has to match against that.

    This isn’t done by Spring, but by the servlet container, and it can be a bit confusing at times.

    You can mitigate against this by using wildcards in @RequestMapping, e.g.

    @RequestMapping(value="**/adduser", method={RequestMethod.POST})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an RPG in development, but I'm still confused about the best way
I'm a newbie to OS X, and totally confused about the way macports works.
i am slightly confused about how jquery's Delegate Function works. If I have a
I have always been challenged by the way lists work and am confused about
I'm confused about which way is the best to have multiple tables get synced
I'm confused about the correct way of using asynchronous socket methods in C#. I
I'm confused about these two keywords and the way to use them in PHP5.
I am always confused about static variables, and the way memory allocation happens for
I can't believe I'm still confused about this but, any way, lets finally nail
I'm a bit confused about the right way to write a code. I read

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.