First the DispatcherServlet is invoked by the Servlet Container.html
The DispatcherServlet finds a mapping which maps to the home method of your Controller and the home method returns a view name "HelloWorld"web
Now the DispatcherServlet uses a View Resolver (your InternalResourceViewResolver) to find the View to render the model through, since the name is "HelloWorld", this maps to the /WEB-INF/view/HelloWorld.html view.spring
Now essentially a call is made to RequestDispatcher.forward("/WEB-INF/views/HelloWorld.html",....app
The Servlet container at this point tries to find the servlet which can handle /WEB-INF/views/HellowWorld.html uri - if it had been a .jsp there is a JSPServlet registered which can handle rendering the jsp, however for *.html there is no servlet registered, so the call ends up with the "default servlet", which is registered with a servlet-mapping of / which probably your DispatcherServlet is.jsp
Now the Dispatcher servlet does not find a controller to handle request for /WEB-INF/views/HelloWorld.html and hence the message that you are seeingthis
已經很清楚的告訴咱們了即便你:url
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">spa
<property name="prefix" value="/WEB-INF/views/"/>htm
<property name="suffix" value=".html"/>servlet
</bean>
這樣配置了
可是你可愛的Web 容器並不知道,你到底要幹嗎?解析的是個What.因此你須要在web中註冊一下:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
順道說一句JSP不是和html同樣的,只是個文件後綴名而已,一句半句也說不清楚,感興趣的朋友能夠翻翻相關資料。