title: how does Spring know from the jsp what controller to use?
body: <p>I have this in web.xml:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;!-- Dispatching handled by StaticFilter --&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>I have this in dispatcher-servlet.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-3.1.xsd"&gt;
  
      &lt;context:annotation-config/&gt;
  
      &lt;!-- Activates scanning of @Repository --&gt;
      &lt;context:component-scan base-package="com.pronto.mexp" /&gt;
  
      &lt;!-- View Resolver for JSPs --&gt;
      &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="requestContextAttribute" value="rc"/&gt;
          &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/&gt;
          &lt;property name="prefix" value="/"/&gt;
          &lt;property name="suffix" value=".jsp"/&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>I have this in AlertsController:</p>
  
  <pre><code>@Controller
  public class AlertsController {
  
      protected final Log logger = LogFactory.getLog(getClass());
  
      @Autowired
      private AlertManager alertManager;
  
      @RequestMapping("/alerts")
      public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
  
          // display in view
          logger.info("Returning alerts view");
  
          List&lt;Alert&gt; alerts = alertManager.getAlerts();
          request.setAttribute("alerts", alerts);
  
          return new ModelAndView();
      }
  
      public void setAlertManager(AlertManager alertManager) {
          this.alertManager = alertManager;
      }
  }
  </code></pre>
  
  <p>And I have this in alerts.jsp:</p>
  
  <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %&gt;
  
  &lt;h3&gt;ALERTS&lt;/h3&gt;
  
  &lt;table border="1"&gt;
  &lt;c:forEach var="alert" items="${alerts}"&gt;
      &lt;tr&gt;
      &lt;td&gt;${alert.hostname}&lt;/td&gt;
      &lt;td&gt;${alert.message}&lt;/td&gt;
      &lt;td&gt;${alert.program}&lt;/td&gt;
      &lt;td&gt;&lt;fmt:formatDate value="${alert.date}" dateStyle="medium"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/c:forEach&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>But when I start the app up and point my browser to localhost:8080/alerts.jsp, I get only the header "ALERTS" and nothing else. It's like Spring doesn't know to use the AlertsController. I know I'm leaving out some key config but I can't see it.</p>