Контролер возвращает не изменяет .jsp файл. Не выводиться информация в ModelMap. ${message} не изменяется на нужное значение. Файл с контролером
package com.pimmpo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class MainController {
@RequestMapping(method = RequestMethod.GET, path = "/")
public String printHello(ModelMap model){
model.addAttribute("message", "TEST");
System.out.println("LOOK HERE");
return "index";
}
//@RequestMapping(method = RequestMethod.GET, path = "/")
}
web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>MainController</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MainController</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
MainController-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns = "http://www.springframework.org/schema/beans"
xmlns:context = "http://www.springframework.org/schema/context"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "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.pimmpo" />
<bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
index.jsp
<html>
<body>
<h2>Hello World!</h2>
<h2>${message}</h2>
</body>
</html>