Welcome file not working with html file in spring

前端 未结 6 1177
难免孤独
难免孤独 2020-12-19 10:09

I have given my welcome file in web.xml But when running the application, it is showing 404 error on http://172.16.2.16:8080/sampletest/

It is a spring

6条回答
  •  失恋的感觉
    2020-12-19 10:23

    You have mapped all your incoming requests to the dispatcher here,

    
        dispatcher
        /
    
    

    So all your URL requests for the application goes inside the dispatcher as '/' maps all incoming requests . check for the stacktraces in your application server log

    update:

    You get the below warning because there are no handler for the '/' pattern,

    WARNING: No mapping found for HTTP request with URI [/AccelFlow/] in DispatcherServlet with name 'dispatcher'

    You can do either of below options ,

    1. Map a url with '/' to the controller
    2. Add a specific URL pattern to the spring dispatcher such as .htm or .do as you wish

    Modify your web.xml,

    
            dispatcher
            *.htm
          
    

    And in your controller,

    @RequestMapping(value = "/test.htm", method = RequestMethod.GET)
    public @ResponseBody Response display() throws Exception {
        accelFlowFacade.disaply();
        Response res = new Response();
        return res;
    }
    

提交回复
热议问题