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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:44:14+00:00 2026-05-22T18:44:14+00:00

I am using Spring MVC with annotation configuration. I have a controller class for

  • 0

I am using Spring MVC with annotation configuration. I have a controller class for handling HTTP GET calls:

@Controller
@RequestMapping("/form")
public class FormController {

    @RequestMapping(value = "/{table}/{identifier}/edit", method = RequestMethod.GET)
    public ModelAndView getEditView(ModelMap map, @PathVariable String table, @PathVariable Object identifier) {
        //generate the view for this record
    }

and a Controller for processing form submits on that URL

@Controller
@RequestMapping("/form")
public class FormSaveController {

    @RequestMapping(value = "/{table}/{identifier}/edit", method = RequestMethod.POST)
    public ModelAndView saveView(WebRequest request, @PathVariable String table, @PathVariable Object identifier) {
        //save the updated values and redirect to view
    }

When I attempt to startup my container, spring complains

Caused by: java.lang.IllegalStateException: Cannot map handler 'FormSaveController' to URL path [/form/{table}/{identifier}/edit]: There is already handler of type [class com.company.web.FormController] mapped.

This seems to indicate what I’m trying to do is not supported in Spring. The reason I am trying to separate the controller for generating the form from the controller saving the form because I am using Springs @ExceptionHandler to handle any runtime exceptions that occur, and I would like to handle an exception for displaying the view differently than an exception for saving a record.

Is there a different way of handling what I am trying to do (utilize Springs @ExceptionHandler annotation for specific kinds of request?)

  • 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-22T18:44:15+00:00Added an answer on May 22, 2026 at 6:44 pm

    The reason I am trying to separate the controller for generating the form from the controller saving the form because I am using Springs @ExceptionHandler to handle any runtime exceptions that occur, and I would like to handle an exception for displaying the view differently than an exception for saving a record

    I would imagine that your view template engine would throw exceptions of a different type hierarchy than exceptions encountered while saving records in your datastore. It may be easiest to place these methods in the same class, and then just address your @ExceptionResolver concern by mapping exceptions of the view engine’s type one way, and DB exceptions another.

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

Sidebar

Related Questions

I am using spring mvc with Annotations, see the following snippet @RequestMapping(value = /configuration/,
I am using Spring MVC to build my web application, and I have a
I have problem using annotated validation in spring 3 mvc. I´m not sure if
I'm building a MVC web application (using the Spring MVC framework), and I'm a
We are using Hibernate 3.1 with Spring MVC 2.0. Our problem occurs when data
Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring
I'm using Spring.net with NHiberante (HibernateTemplate) to implement my DAO's. I also have some
I am using Spring Forms for my web application. For nested properties, the form
We are using Spring MVC 3.0.5.RELEASE with Hibernate 3.5.4-Final without transactions. Every time we
I'm using Spring MVC. I want to include menu page (named menu.jsp) with a

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.