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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:33:04+00:00 2026-05-17T16:33:04+00:00

First off, if this is a duplicate, I apologize. I did quite a bit

  • 0

First off, if this is a duplicate, I apologize. I did quite a bit of searching but couldn’t find much and I suspect I wasn’t using the right terms…

I’m building a site with Spring MVC and using the annotation-driven configuration. What I’d like to do is have urls that do not have any extension at the end (.html, .do, etc). So they would look like http://www.mysite.com/account/create which I know is something that is traditionally accomplished using mod_rewrite on Apache or using files without extensions. It seems as though it could be done without using a rewrite engine (I know about the urlrewritefilter project) as Spring has support for pulling parameters out of the request string (See section 15.3.2.1 of the documentation) and the pet store example doesn’t appear to have extensions at the end of its urls.

However, it seems as though whenever I attempt to forward all requests to the dispatcher servlet (my thinking for how to negate the need for something like *.htm), I run into trouble…I’m able to get it work (using XML configuration, I recently switched to annotation configuration) using just a standard “*.htm” for all of the pages.

My controller code looks like

@Controller
@RequestMapping("/home")
public class HomeController {

    ...

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

        ...

    }

And my web.xml looks like

    <servlet>
        <servlet-name>dispatch</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatch</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

Am I missing something here? Is this possible without using a rewrite engine?

I should note, the above configuration doesn’t work. It always returns a 404 error…

  • 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-17T16:33:04+00:00Added an answer on May 17, 2026 at 4:33 pm

    Using URL patterns such as /* is generally a bad idea, since the container will forward everything to the DispatcherServlet, including internal requests for JSPs. So when your controller returns the JSP name in the ModelAndView, it will be fed back into the DispatcherServlet again, giving you the 404.

    You either need to retain the file extension in your paths, or you need a prefix of some kind to allow you to distinguish requestd for the DispstcherServlet from requests for JSPs.

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

Sidebar

Related Questions

First off, apologies if this question has been asked before but I couldn't find
First off I've been working with Java's Concurrency package quite a bit lately but
First off, this question is ripped out from this question. I did it because
First off, I apologize if this doesn't make sense. I'm new to XHTML, CSS
First off, there's a bit of background to this issue available on my blog:
First off, this is NOT a duplicate of: Turn a C string with NULL
First off, let me preface this question by stating that I'm really a pretty
This is a bit of a stretch, but I have an interesting (to me)
First off, I know this may be a very stupid question, so don't shoot
First off, I want to say this site is AWESOME! and it helped me

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.