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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:46:47+00:00 2026-05-25T15:46:47+00:00

I have a spring-based web application. In a controller I specified the following: @RequestMapping(value

  • 0

I have a spring-based web application. In a controller I specified the following:

@RequestMapping(value = "/foo/index.html", method = RequestMethod.GET)
public ModelAndView handleIndex(HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    return new ModelAndView("public/foo/index");
}

The application web.xml servlet mapping:

<servlet-mapping>
    <servlet-name>jib</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>

When I make a request to the http://myhost/foo/index.hml everything works fine, but when I am trying to invoke http://myhost/foo/ – I receive a 404 error.

My question is how I can handle http://myhost/foo/ request exactly how I handle the http://myhost/foo/index.html 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-25T15:46:47+00:00Added an answer on May 25, 2026 at 3:46 pm

    Ok, the solution is shown below

    1. Change the servlet-mapping section in the web.xml file

      <servlet-mapping>
      <servlet-name>jib</servlet-name>
      <url-pattern>/</url-pattern>
      

    2. Change the @RequestMapping value parameter:

      @RequestMapping(value = {"/foo/", "/foo/index.html"}, method = RequestMethod.GET)
      public ModelAndView handleIndex(HttpServletRequest request,
      HttpServletResponse response) throws Exception {
      return new ModelAndView("public/foo/index");
      }
      

    Now, the handleIndex method handles all requests for /foo/ and /foo/index.html paths

    Hope it will help somebody

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

Sidebar

Related Questions

We have a legacy web application (not Spring based) and are looking for best
I have an existing, fully functional Spring web application based on Spring 2.5.6 -
I have a web application that's based on Spring and the application contexts, applicationContext.xml
I have the following controller mapped as @Controller( value = stockToStoreController ) @RequestMapping(/stsr) public
I have a spring-based Web Service. I now want to build a sort of
I have a Spring Security (form based authentication) web app running CXF JAX-RS webservices
Lets say we have a web based application where users login to their own
I have a web application based on the sharp-architecture framework. It actually use NHibernate
I have my web application written in Spring MVC. It is quite simple app
The environment of my application: web-based, Spring MVC+Security, Hibernate, MySQL(InnoDB) I am working on

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.