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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:02:43+00:00 2026-05-15T21:02:43+00:00

On my Tomcat-Spring-Java project I want to have the following URLS /index – to

  • 0

On my Tomcat-Spring-Java project I want to have the following URLS

/index – to display entry page

/login – Login page

/cars/ – list the available cars

/cars/{id} – show a particular car

/cars/{id}/action – do action on this particular car

/people/ – list the available people

/people/{id} – show a particular person

/people/{id}/action – do action on this particular person

Ive got my dispacher-servlet map like this in web.xml.

    <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/login</url-pattern>
    <url-pattern>/logout</url-pattern>
    <url-pattern>/index</url-pattern>
    <url-pattern>/cars/*</url-pattern>
    <url-pattern>/people/*</url-pattern>
</servlet-mapping>

And my dispatcher-servlet.xml map like:

        <bean id="urlMap"
    class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="urlMap">
        <props>
            <prop key="/login">loginController</prop>
            <prop key="/logout">logoutController</prop>
            <prop key="/index">welcomeController</prop>
            <prop key="/cars">listCarsController</prop>
            <prop key="/cars/">listCarsController</prop>
            <prop key="/cars/*">showCarController</prop>
            <prop key="/cars/*/action">actionCarController</prop>
            <prop key="/people">listPeopleController</prop>
            <prop key="/people/">listPeopleController</prop>
            <prop key="/people/*">showPersonController</prop>
            <prop key="/people/*/action">actionPersonController</prop>
        </props>
    </property>
</bean>

This is not working as expected, since when I visit for example /people/1/action, The Dispacher servlet servlet says looking handler for [1/action] and of course it is not as search but with the people/ in front to separate the peoples id to the cars id.

Is like the ‘*’ would be the only URL entered.

By the way I want to keep my URL’s extension less, I know that to map the dispatcher to *.htm on the web.xml file, would have taken care of the problem.
But its got to be a way to map the dispatche or to make the dispatcher search for a full url definition.

  • 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-15T21:02:43+00:00Added an answer on May 15, 2026 at 9:02 pm

    You may set a alwaysUseFullPath property:

    <bean id="urlMap" 
        class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> 
    
        <property name = "alwaysUseFullPath" value = "true" />
    
        ...
    </bean>
    

    Alternatively, you may set a single <url-pattern> for the dispatcher servlet. Since it can’t be /*, you need to use UrlRewriteFilter.

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

Sidebar

Related Questions

I'm following a tutorial to set up a skeleton application for tomcat : http://maestric.com/doc/java/spring/setup#build_files
I have a fairly standard Spring/Hibernate Java project where I need to set a
I have a java web application wired using Spring on Tomcat. I need a
I have a web project built in eclipse using Spring and for Tomcat. Before
I have created an index.jsp as the start page in an Eclipse project using
I have a spring project and using ANT to compile/deploy my war to Tomcat.
I have a Spring MVC project that I've been deploying to Tomcat (installed both
I am currently building an application using Tomcat, Spring and JAVA. I am using
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
We have a Tapestry-Spring-Hibernate webapp running on Tomcat 6, handing about a few 1000

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.