Bom galera estou com problema ao criar meu primeiro projeto simples usando Spring MVC.
Web.xml
`<?xml version="1.0" encoding="UTF-8"?>
<display-name>contas</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!--Declaração do servlet do Spring MVC abaixo -->
<servlet>
<servlet-name>spring mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-context.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>spring mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
`
spring-context
`<?xml version="1.0" encoding="UTF-8"?>
<!-- Pacote Base na minha aplicação -->
<context:component-scan base-package="br.com.caelum.contas.controller" />
<mvc:annotation-driven /> <!-- Vamos usar as anotações. -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
`
Classe java
`package br.com.caelum.contas.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class OlaMundoControler {
@RequestMapping("/OlaSpring")
public String executa() {
System.out.println("Executando um comando com Spring");
return "ok";
}
}
`
ok.jsp
`<%@ page language=“java” contentType="text/html; charset=UTF-8"
pageEncoding=“UTF-8”%>