Caros, boa noite!
Estou estudando e sinceramente estou tendo um problema chato e que pelo visto é ridículo, porém não consigo solucioná-lo. Minha aplicação de estudos sobre o spring mvc:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
web.xml
<web-app>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-context.xml
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.teste" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
OlaMundoController.java
package com.teste.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class OlaMundoController {
@RequestMapping("/olaMundo")
public String execute() {
System.out.println("Executando a lógica com Spring MVC");
return "OlaMundo";
}
}
olaMundo.jsp
<html>
<head>
<title>Hello Spring MVC</title>
</head>
<body>
<h2>Olá Spring MVC</h2>
</body>
</html>
Estrutura dos diretórios:
Ao acessar através da URL: http://localhost:8080/teste/olaMundo , me retorna:
[code]HTTP Status 404 - /teste/olaMundo
type Status report
message /teste/olaMundo
description The requested resource (/teste/olaMundo) is not available.
Apache Tomcat/7.0.10[/code]
Já estudei outros projetos e não vejo onde estou errando, alguém pode me dar uma luz? Obrigado e boa noite!