Hi I have the following code: Controller:
@Controller
public class HelloWorldController {
@RequestMapping("/hello")
public ModelAndView HelloWorld() {
String message = "My First SpringMVC Program ";
return new ModelAndView("hello","message",message);
}
web.xml
<servlet>
<!-- load on startup is used to determine the order of initializing the servlet when the application
server starts up. The lower the number, earlier it starts -->
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
spring-servlet.xml
<context:component-scan
base-package="org.example.controller"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView">
</property>
<property name="prefix" value="/WEB-INF/jsp/">
</property>
<property name="suffix" value=".jsp"></property>
When I run this code, I get the following warning "WARNING: No mapping found for HTTP request with URI [/SpringDemo/Hello.html] in DispatcherServlet with name 'spring'". What wrong am I doing?