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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:40:54+00:00 2026-05-30T17:40:54+00:00

Morning, Having issues mapping a controller to / (i.e. localhost:8080/someApp/ would map to @Controller(/))

  • 0

Morning,

Having issues mapping a controller to / (i.e. localhost:8080/someApp/ would map to @Controller(“/”)) while also using mvc:resources

web.xml mapping:

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

mvc:resources

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

The server loads the page correctly, but when I map to an asset i.e.

<link type="text/css" rel="stylesheet" href="<c:url value="/resources/css/blueprint/print.css"/>" />

When clicking the css file via view-source in a web browser, the server response maps back to the index page, rather than the resource. Leads me to believe it’s related to the servlet-mapping.

Any help with this would be great!

Thanks!

Edit:
Forgot to mention, if I bind the controller to say:

@Controller("/pages")

Everything works fine, just would rather have the context root be able to respond correctly.

  • 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-30T17:40:55+00:00Added an answer on May 30, 2026 at 5:40 pm
    @Controller("/)
    

    and

    @RequestMapping("/")
    

    are not the same thing.

    Since @RequestMapping may be placed at a class level, placing the mapping on the class will have the desired affect.

    Example:

    @Controller
    @RequestMapping("/")
    public class RootController
    {
    
      @RequestMapping(method=RequestMethod.GET)
      public String index()
      {
        return "index";
      }
    
    }
    

    This will work correctly, and also works with the mvc:resources bean.

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

Sidebar

Related Questions

Hello good morning everyone, i am having a weird issue when using imagePickerController. Actually
Good morning, I'm learning MVC using the music store examples on the www.asp.net/mvc page,
Good morning all, I'm having a few problems with a method in my C#
Good morning fellows, I am having an issue with facebook api: is it possible
Good morning, I'm having a really annoying issue with Highcharts, such that the x-axis
Good morning! I'm having great success so far with CodeIgniter. I'm new to PHP
I was having a look at a few different web servers this morning when
Having a bit of trouble wrapping my head around Qtimer this morning. Here's the
Morning, I'm having some trouble creating tables/loading fixtures. (symfony 1.4.6 with the bundled Doctrine
Good morning all. I'm having a small crisis with table views in a 3.1

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.