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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:06:51+00:00 2026-06-06T21:06:51+00:00

Hi I am creating a spring mvc app. The spring context seems to be

  • 0

Hi I am creating a spring mvc app. The spring context seems to be mapping the controller methods to wrong urls.

I’ve following controllers:

HelloWorldController

package com.springapp.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/hello")
public class HelloWorldController {

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView helloWorld() {

        String message = "Hello World, Spring 3.0!";
        return new ModelAndView("hello", "message", message);
    }
}

ContactsController

package com.springapp.controller;

import com.springapp.form.Contact;
import com.springapp.service.ContactService;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/contacts")
public class ContactsController {

    @Autowired
    private ContactService contactService;

    @RequestMapping(method = RequestMethod.GET)
    public String listContacts(Model map) {

        map.addAttribute("contact", new Contact());
        map.addAttribute("contactList", contactService.listContacts());

        return "contact";
    }

    @RequestMapping(value="{contactId}", method=RequestMethod.GET)
    public String showContact(@PathVariable("contactId") Integer contactId) {

        contactService.getContact(contactId);
        return "redirect:/contacts";
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public String addContact(@ModelAttribute("contact") Contact contact, BindingResult result) {

        contactService.addContact(contact);
        return "redirect:/contacts";
    }

    @RequestMapping("/{contactId}/delete")
    public String deleteContact(@PathVariable("contactId") Integer contactId) {

        contactService.removeContact(contactId);
        return "redirect:/contacts";
    }
}

However the spring context is mapping them as:

INFO: Mapped URL path [/contacts/new] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/new.*] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/new/] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/addContact] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/addContact.*] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/addContact/] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/delete/{contactId}] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/delete/{contactId}.*] onto handler 'contactsController'
INFO: Mapped URL path [/contacts/delete/{contactId}/] onto handler 'contactsController'
INFO: Mapped URL path [/hello] onto handler 'helloWorldController'
INFO: Mapped URL path [/hello.*] onto handler 'helloWorldController'
INFO: Mapped URL path [/hello/] onto handler 'helloWorldController'

Where is it getting these new and addContact patterns? Also the mapping /contacts is missing.

  • 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-06T21:06:52+00:00Added an answer on June 6, 2026 at 9:06 pm

    Your problem could depend on mappings you had in a old version of your application.
    Try to update the deployed version in Tomcat.

    If you are using Eclipse to run/debug your project try to clean/compile your projet and than to deploy the new version in Tomcat.

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

Sidebar

Related Questions

I am creating web app with spring-mvc [Layers: Controller -> Service -> DAO ->
In my Spring MVC based web-app, I'm manually creating an Errors/BindingResult object after manually
I'm currently testing the controller in my mvc app and I'm creating a fake
I am trying out creating Spring MVC app on SpringToolSuite (STS) IDE. I do:
I'm creating my first Spring MVC app on Tomcat 6. Certain pages will be
I am creating a Spring MVC application for the first time. It seems like
I am creating extension methods for the HtmlHelper class in an MVC web app.
I am creating a Spring MVC Hibernate application using MySQL. Where should I save
I'm creating a web application using spring mvc. I have started to incorporate the
I am newbie in spring. using spring 3.0 mvc. I am creating a spring

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.