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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:12:26+00:00 2026-05-17T22:12:26+00:00

I have a problem with my spring controller/request mapping struture. In web.xml I have

  • 0

I have a problem with my spring controller/request mapping struture. In web.xml I have defined 2 dispatcher servlets, that map the following request paths:

  1. Servlet: /pathA/*
  2. Servlet /pathB/*

All my controllers are defined in the package com.myproject.controllers, so both controllers serving for paths under /pathA/* and /pathB/*.
I am doing a component-scan in both of my servlets. How do I need to set the ReuestMapping annotations for the following Controller:

@Controller
public class MyController {

  // /pathA
  public void action1() {
  }

  // /pathA/action2
  public void action2() {
  }
}

I really get confused here, i have tried so many different things, I hope you can help me!

Sincerely,
Heinrich

  • 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-17T22:12:27+00:00Added an answer on May 17, 2026 at 10:12 pm

    If you actually need to use several DispatcherServlet, perhaps the best approach is to place their controllers into separate packages and limit component scan of each servlet to its own package.

    If you can’t do it for some reason, you can configure your servlets as follows:

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

    In this case you can use servlet paths in @RequestMapping, as stas showed.

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

Sidebar

Related Questions

I'm facing following problem actually: I'm using Spring with jQuery. I have Controller: @Controller
I have a problem with Spring 3.0.7 Request mapping and the Spring standard theme
I have the following problem with the timeouts in Spring Security with JSF: I've
Hi i am new to Spring and I have a following problem: I had
I have what seems like a simple problem. I have a Spring web app,
I'm having a strange problem with Spring MVC. I have a simple controller like
I have small problem with Spring MVC. Basically what I'm trying to do is
I have a problem that output string must be utf8-formatted, I am writing currently
I'm configuring and testing spring security 3.1.0. I have a user that has ROLE_COMPANY_OWNER.
I have a problem in getting the logged in user in my spring-extjs application.I

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.