How to map requests to HTML file in Spring MVC?

前端 未结 7 1190
你的背包
你的背包 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:17

    Resolver class is used to resolve resources of a view class, view class in turn, generates the views from resources. For example, with a typical InternalResourceViewResolver as below:

    
            
            
    
    

    A view name "home" will be mapped as "/WEB-INT/views/home.jsp" and then translated into a JSP view using view class InternalResourceView (which is for JSP). If you replace the suffix value with ".html", Spring can get the specific resource "/WEB-INT/views/home.html" but doesn't know how to generate it.

提交回复
热议问题