title: Spring MVC model attribute not displaying
body: <p>The output displays ${message} not the "Spring". 
  <br/>
  Is there any dependency needed to show the value of my message?<Br/>
  I already used Spring MVC but i used xml configuration. Am I missing something here?
  Hope you can help me figure this out.</p>
  
  <pre><code>&lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;!-- Spring dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
              &lt;version&gt;1.1.3&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>package com.jwlayug.controller;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  @Controller
  public class ControllerA {
       @RequestMapping(value = "/hello")
         public String printHello(Model model) {
            model.addAttribute("message", "Spring");
            System.out.println("this method is called!");
            return "hellow";
         }
  
  
  }
  </code></pre>
  
  <p>config</p>
  
  <pre><code>package com.jwlayug.config;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  import org.springframework.web.servlet.view.JstlView;
  import org.springframework.web.servlet.view.UrlBasedViewResolver;
  
  @Configuration
  // Marks this class as configuration
  // Specifies which package to scan
  @ComponentScan("com.jwlayug")
  // Enables Spring's annotations
  @EnableWebMvc
  public class Config {
  
      @Bean
      public UrlBasedViewResolver setupViewResolver() {
          UrlBasedViewResolver resolver = new UrlBasedViewResolver();
          resolver.setPrefix("/WEB-INF/views/");
          resolver.setSuffix(".jsp");
          resolver.setViewClass(JstlView.class);
          return resolver;
      }
  }
  
  
  package com.jwlayug.config;
  import javax.servlet.ServletContext;
  import javax.servlet.ServletException;
  
  import javax.servlet.ServletRegistration.Dynamic;
  
  import org.springframework.web.WebApplicationInitializer;
  import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
  import org.springframework.web.servlet.DispatcherServlet;
  
  public class WebInitializer implements WebApplicationInitializer{
      public void onStartup(ServletContext servletContext)
              throws ServletException {
  
          AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
          ctx.register(Config.class);
  
          ctx.setServletContext(servletContext);
  
          Dynamic servlet = servletContext.addServlet("dispatcher",
                  new DispatcherServlet(ctx));
          servlet.addMapping("/");
          servlet.setLoadOnStartup(1);
  
      }
  }
  </code></pre>
  
  <p>jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
      &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  ${message}
  &lt;c:out value="${message}" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>