title: spring boot jsp foreach results into excpetion
body: <p>I´m trying to implement JSP &amp; JSTL into my fresh spring boot application, but run into an error. </p>
  
  <p>Current Setup:</p>
  
  <p>In pom.xml i added:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;jstl&lt;/artifactId&gt;
  &lt;/dependency&gt;
  
  &lt;!-- Need this to compile JSP --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Within the AppConfig this is added:</p>
  
  <pre><code>@Override
  public void configureViewResolvers(ViewResolverRegistry registry) {
      InternalResourceViewResolver resolver = new InternalResourceViewResolver();
      resolver.setPrefix("/WEB-INF/view/");
      resolver.setSuffix(".jsp");
      resolver.setViewClass(JstlView.class);
      registry.viewResolver(resolver);
  }
  </code></pre>
  
  <p>The Test-Controller / called function is Setup like that:</p>
  
  <pre><code>@RequestMapping(path = "/listtest")
  public String listTest(Model model) {
      List&lt;String&gt; itemsTest = new ArrayList&lt;&gt;();
  
      for(int i = 0; i &lt; 300; i++){
          itemsTest.add("test-Item "  + i );
      }
  
      model.addAttribute("itemsTest", testItems);
  
      return "items/testlist";
  }
  </code></pre>
  
  <p>In test testlist.jsp i added this:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  
     &lt;html lang="de"&gt;
     &lt;head&gt;
     &lt;title&gt;JSP TEST&lt;/title&gt;
     &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table&gt;
     &lt;tr&gt;
        &lt;th&gt;Column #1&lt;/th&gt;
        &lt;th&gt;Column #2&lt;/th&gt;
        &lt;th&gt;Column #3&lt;/th&gt;
      &lt;/tr&gt;
      &lt;c:forEach items="${itemsTest}" var="testItem"&gt;
         &lt;tr&gt;
             &lt;td&gt;&lt;c:out value="${testItem}"/&gt;&lt;/td&gt;
             &lt;td&gt;&lt;c:out value="${testItem}"/&gt;&lt;/td&gt;
             &lt;td&gt;&lt;c:out value="${testItem}"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/c:forEach&gt;
   &lt;/table&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>Until the last Item, everything is working fine, but then two Exceptions are thrown:</p>
  
  <pre><code>Servlet.service() for servlet [jsp] threw exception
  
  java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
      at javax.servlet.jsp.jstl.core.LoopTagSupport.unExposeVariables(LoopTagSupport.java:587) ~[jstl-1.2.jar:1.2]
      at javax.servlet.jsp.jstl.core.LoopTagSupport.doFinally(LoopTagSupport.java:323) ~[jstl-1.2.jar:1.2]
      at org.apache.jsp.WEB_002dINF.view.items.testlist_jsp._jspx_meth_c_005fforEach_005f0(testlist_jsp.java:134) ~[na:na]
      at org.apache.jsp.WEB_002dINF.view.items.testlist_jsp._jspService(testlist_jsp.java:72) ~[na:na]
  </code></pre>
  
  <p>And</p>
  
  <pre><code>Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;] with root cause
  
  java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
      at javax.servlet.jsp.jstl.core.LoopTagSupport.unExposeVariables(LoopTagSupport.java:587) ~[jstl-1.2.jar:1.2]
      at javax.servlet.jsp.jstl.core.LoopTagSupport.doFinally(LoopTagSupport.java:323) ~[jstl-1.2.jar:1.2]
      at org.apache.jsp.WEB_002dINF.view.items.testlist_jsp._jspx_meth_c_005fforEach_005f0(testlist_jsp.java:134) ~[na:na]
      at org.apache.jsp.WEB_002dINF.view.items.testlist_jsp._jspService(testlist_jsp.java:72) ~[na:na]
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) ~[jasper-runtime-5.5.23.jar:na]
  </code></pre>
  
  <p>Thats the output of the last two loops:</p>
  
  <p><a href="https://i.stack.imgur.com/HqUqX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HqUqX.png" alt="lastlines-output"></a></p>
  
  <p>What am i doing wrong?</p>