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

  • Home
  • SEARCH
  • 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 6344643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:40:52+00:00 2026-05-24T20:40:52+00:00

I am having ongoing problems configuring my Spring Controller to map to specific URLs,

  • 0

I am having ongoing problems configuring my Spring Controller to map to specific URLs, and I have it down to a fairly simple scenario, that I think should be working:

I am configuring my Controller class using annotations, and it looks as follows:

@Controller
@RequestMapping(value = "/question/**")
public class QuestionController 
{

    /**
     * Method to build users questions list
     * 
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping("/list")
    public ModelAndView list(HttpServletRequest request, HttpServletResponse response) throws Exception{
        //Display Questions List
    }
}

There is no further configuration of the Controller, I simply have the <mvc:annotation-driven/> configuration and the <context:component-scan>.. configuration in my webmvc config, so the controller is automatically detected.

Now, when I navigate to /question/list the applications fails to find the resource and I get a ResourceNotFound error. However, If I navigate to /question/question/list then the app loads the page I would expect correctly.

Any ideas why this is directing to the method using /question/question/list?


Following this I tried adding the configuration to my webmvc config to force all RequestMappings to use the parameters alwaysUseFullPath=true, I did this as follows:

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" p:order="3">
        <property name="alwaysUseFullPath" value="true" />
    </bean>

This time, when I navigate to /question/list it still fails to load the correct page, but the logs show that Spring is at least identifying the correct Controller, but just failing to find the method (before it did not even find the Controller based on the URL):

2011-08-09 18:02:27,885 [http-8080-3] DEBUG org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Matching patterns for request [/question/list] are [/question/**/list/, /question/**/list, /question/**/, /question/**]
2011-08-09 18:02:27,886 [http-8080-3] DEBUG org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Mapping [/question/list] to handler 'com.tmm.enterprise.microblog.controller.QuestionController@143c423'
2011-08-09 18:02:27,886 [http-8080-3] DEBUG org.springframework.web.servlet.DispatcherServlet - Last-Modified value for [/microblog/question/list] is: -1
2011-08-09 18:02:27,886 [http-8080-3] DEBUG org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'microblog' processing GET request for [/microblog/question/list]
2011-08-09 18:02:27,886 [http-8080-3] DEBUG org.springframework.web.servlet.handler.SimpleMappingExceptionResolver - Resolving exception from handler [com.tmm.enterprise.microblog.controller.QuestionController@143c423]: org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException: No matching handler method found for servlet request: path '/list', method 'GET', parameters map[[empty]]
2011-08-09 18:02:27,886 [http-8080-3] DEBUG org.springframework.web.servlet.handler.SimpleMappingExceptionResolver - Resolving to view 'resourceNotFound' for exception of type [org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException], based on exception mapping [.NoSuchRequestHandlingMethodException]
2011-08-09 18:02:27,887 [http-8080-3] DEBUG org.springframework.web.servlet.handler.SimpleMappingExceptionResolver - Exposing Exception as model attribute 'exception'

It seems to me as though it is a relatively simple thing I am trying to achieve in wiring a Controller to a URL using the annotations, but it is not working correctly – has any one come across this or see any glaring errors on my part?


UPDATE

I have made some progress in my investigations.

In my web.xml I define the servlet mapping as follows:

<servlet-mapping>
        <servlet-name>microblog</servlet-name>
        <url-pattern>/question/*</url-pattern>
    </servlet-mapping>

If I remove this servlet mapping, (I still have a servlet-mapping that maps all .html to the same servlet) and change the URL i am using to /question/list.html then it works (also I change the method level mapping of the @RequestMapping annotation on my list() method in the question controller to /list.html).

In summary:

  1. I have servlet mapping /question to the web context

  2. I have another mapping of /question to the QuestionController

  3. I have a method level mapping for my list method of /list

Now I don’t want my URLs to end to .html for these cases – does anyone know how I can get around this problem? It seems as though maybe the servlet-mapping strips out the matched /question string from the URL (hence /question/list not working, but /question/question/list working)

  • 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-24T20:40:54+00:00Added an answer on May 24, 2026 at 8:40 pm

    set

    <url-pattern>/</url-pattern> 
    

    for urls without html
    and use

    <mvc:resources mapping="/resources/**" location="/resources/" />
    

    for resources like .css, .jpg etc.

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

Sidebar

Related Questions

Having this route: map.foo 'foo/*path', :controller => 'foo', :action => 'index' I have the
I have been having an ongoing fight with this email setup. The code below
I'm having a specific problem that I'd love some insight on. Here is my
Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and
I've been having this memory leak issue for days and I think I have
Having a headache with IE. I have an image (24x24) which I'd like to
Having a strange issue with the TabContainer in the AJAX Toolkit. We have several
I’m having a weird problem with notifications. I have created an on going notification,
Im having an ongoing issue with my site, it basically times out and dies.
I'm having an ongoing issue with dealing with getting lists of items based on

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.