How to map requests to HTML file in Spring MVC?

前端 未结 7 1175
你的背包
你的背包 2020-11-29 20:44

Basic configuration files looks unintuitive.

If I create simple hello world example, and then rename home.jsp to home.html and edit

7条回答
  •  囚心锁ツ
    2020-11-29 21:16

    You have this problem because there might not be any servlet registered for mapping *.html.
    so the call ends up with the "default servlet", which is registered with a servlet-mapping of / which probably your DispatcherServlet is.
    Now the Dispatcher servlet does not find a controller to handle request for home.html and hence the message that you are seeing.
    To solve this problem you can register *.html extension to be handled by JSPServlet and then it should work cleanly.

提交回复
热议问题