title: JSP getAttribute() returning null
body: <p>So in my Servlet I have the following:  </p>
  
  <pre><code>public void doGet(HttpServletRequest req, HttpServletResponse resp)
              throws ServletException, IOException {
          resp.setContentType("text/html");
          req.setAttribute("colNames","ka");
          req.setAttribute("items", new String[]{});
          //System.out.println(req.getAttribute("colNames"));
          req.getRequestDispatcher("/index.jsp").forward(req,resp);
  }
  </code></pre>
  
  <p>My Servlet:</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;%@ page isELIgnored="false"%&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;NewGem OrderInfo&lt;/title&gt;
      &lt;script src="sorttable.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;%= request.getAttribute("colNames") %&gt;
  &lt;table id="table" class="sortable"&gt;
      &lt;tr&gt;
          &lt;c:forEach items="${param.colNames}" var="col"&gt;
              &lt;td&gt;${col}&lt;/td&gt;
          &lt;/c:forEach&gt;
      &lt;/tr&gt;
      &lt;c:forEach items="${param.items}" var="row"&gt;
          &lt;tr&gt;
              &lt;c:forEach items="${row.elements()}" var="value"&gt;
              &lt;td&gt;${value}&lt;/td&gt;
              &lt;/c:forEach&gt;
          &lt;/tr&gt;
      &lt;/c:forEach&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      id="WebApp_ID" version="2.5"&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;display-name&gt;EntityDumpServlet&lt;/display-name&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;dump&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;EntityDumpServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;
              com.jpmorgan.d1.ptg.web.EntityDumpServlet
          &lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;EntityDumpServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/dump&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>So I'm just running the get, have only this servlet nothing else.</p>
  
  <p>I know that I should use JSTL and I am, but this was my way of checking that it was not a JSTL problem but some what a java problem. Anyone have any ideas?</p>
  
  <p>PS: If I do just <code>&lt;%= request %&gt;</code> I get <code>org.apache.catalina.connector.RequestFacade@58c3fbeb</code> so the problem is not in not casting the result to String.<br>
  And if I do on the servlet <code>System.out.println(req);</code> I get <code>org.apache.catalina.connector.RequestFacade@4ac37ce2</code>, which means for some reason the request passed and received are different?</p>
  
  <p>Result: It turned out that for some reason the IDE is doing some weird stuff and introduced this problem in the forwarding. When I deployed it on with maven compiled WAR file on the tomcat it worked okay.</p>