title: HTTP Status [500] – [Internal Server Error]. An exception occurred processing JSP page [/WEB-INF/views/games.jsp] at line [24]
body: <p>just following tutorial and got some problems with Spring MVC. Could you tell me why i got problems with my forEach loop and how i can repair it ?</p>
  
  <blockquote>
    <p>HTTP Status [500] – [Internal Server Error]</p>
  </blockquote>
  
  <hr>
  
  <p>Type Exception Report</p>
  
  <blockquote>
    <p>Message An exception occurred processing JSP page [/WEB-INF/views/games.jsp] at line [24]</p>
    
    <p>Description The server encountered an unexpected condition that prevented it from fulfilling the request.</p>
    
    <p>Exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page [/WEB-INF/views/games.jsp] at line [24]
    <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>21: 
  22:  &lt;section class="container"&gt;
  23:   &lt;div class="row"&gt;
  24:    &lt;c:forEach items="${games}" var="game"&gt;
  25:     &lt;div class="col-sm-6 col-md-3" style="padding-bottom: 15px"&gt;
  26:      &lt;div class="thumbnail"&gt;
  27:      &lt;img src="&lt;c:url value="/resource/images/${game.gameId}.png"&gt;&lt;/c:url&gt;" alt="image"  style = "width:100%"/&gt;</code></pre>
  </div>
  </div>
  </p>
    
    <p>Stacktrace:
        org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:588)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
        org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
        org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
        org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)</p>
    
    <p>Root Cause
    javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in &lt;forEach&gt;
        org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:669)
        org.apache.jsp.WEB_002dINF.views.games_jsp._jspService(games_jsp.java:169)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
        org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
        org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
        org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)</p>
    
    <p>Root Cause
    javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in &lt;forEach&gt;
        org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:274)
        org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:238)
        org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:155)
        javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:256)
        org.apache.jsp.WEB_002dINF.views.games_jsp._jspx_meth_c_005fforEach_005f0(games_jsp.java:193)
        org.apache.jsp.WEB_002dINF.views.games_jsp._jspService(games_jsp.java:151)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
        org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
        org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
        org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)</p>
  </blockquote>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;link rel="stylesheet"
   href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"&gt;
  &lt;title&gt;Gry&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;section&gt;
    &lt;div class="jumbotron"&gt;
     &lt;div class="container"&gt;
      &lt;h1&gt;Gry&lt;/h1&gt;
      &lt;p&gt;PS3  PS4  XBOX 360  XBOX ONE&lt;/p&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/section&gt;
  
   &lt;section class="container"&gt;
    &lt;div class="row"&gt;
     &lt;c:forEach items="${games}" var="game"&gt;
      &lt;div class="col-sm-6 col-md-3" style="padding-bottom: 15px"&gt;
       &lt;div class="thumbnail"&gt;
       &lt;img src="&lt;c:url value="/resource/images/${game.gameId}.png"&gt;&lt;/c:url&gt;" alt="image"  style = "width:100%"/&gt;
        &lt;div class="caption"&gt;
         &lt;h3&gt;${game.gameName}&lt;/h3&gt;
         &lt;p&gt;${game.gameDescription}&lt;/p&gt;
         &lt;p&gt;${game.gamePrice} PLN&lt;/p&gt;
         &lt;p&gt;Pozostało: ${game.gamesInStock}&lt;/p&gt;
         &lt;p&gt;
          &lt;a
           href=" &lt;spring:url value="/games/game?id=${game.gameId}" /&gt; "
           class="btn btn-primary"&gt; &lt;span
           class="glyphicon-info-sign glyphicon" /&gt;&lt;/span&gt; Szczegóły
          &lt;/a&gt;
         &lt;/p&gt;
  
        &lt;/div&gt;
       &lt;/div&gt;
      &lt;/div&gt;
     &lt;/c:forEach&gt;
    &lt;/div&gt;
   &lt;/section&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> package com.kk.gamestore.controller;
  
  import java.util.List;
  import java.util.Map;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.util.StringUtils;
  import org.springframework.validation.BindingResult;
  import org.springframework.web.bind.WebDataBinder;
  import org.springframework.web.bind.annotation.InitBinder;
  import org.springframework.web.bind.annotation.MatrixVariable;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RequestParam;
  
  import com.kk.gamestore.domain.Game;
  import com.kk.gamestore.service.GameService;
  
  @RequestMapping("/games")
  @Controller
  public class GameController {
  
   @Autowired
   private GameService gameService;
  
   @RequestMapping
   public String Welcome(Model model) {
    model.addAttribute("games", gameService.getAllGames());
    return "games";
   }
  
   @RequestMapping("/all")
   public String allGames(Model model) {
    model.addAttribute("games", gameService.getAllGames());
    return "games";
   }
   
   @RequestMapping("/{platform}")
   public String getGamesByPlatform(Model model, @PathVariable("platform") String gamePlatform) {
    model.addAttribute("games", gameService.getGamesByPlatform(gamePlatform));
    return "games";
   }
   
   @RequestMapping("/filter/{ByCriteria}")
   public String getGamesByFilter(@MatrixVariable(pathVar="ByCriteria")
   Map&lt;String,List&lt;String&gt;&gt; filterParams, Model model){
    model.addAttribute("games", gameService.getGamesByFilter(filterParams));
    return "games";
   }
   
   @RequestMapping("/game")
   public String getGamesById(@RequestParam("id") String gameId, Model model){
    model.addAttribute("games", gameService.getGameById(gameId));
    return "games";
   }
   
   @RequestMapping(value = "/add", method = RequestMethod.GET)
   public String getAddNewGameForm(Model model) {
   Game newGame = new Game();
   model.addAttribute("newGame", newGame);
   return "addGame";
   }
   
   @RequestMapping(value = "/add", method = RequestMethod.POST)
   public String processAddNewGameForm(@ModelAttribute("newGame") Game gameToBeAdded, BindingResult result) {
    String[] suppressedFields = result.getSuppressedFields();
    if (suppressedFields.length &gt; 0) {
    throw new RuntimeException("Próba wiązania niedozwolonych pól: " + StringUtils.arrayToCommaDelimitedString(suppressedFields));
    }
   gameService.addGame(gameToBeAdded);
   return "redirect:/games";
   }
   
   @InitBinder
   public void initialiseBinder(WebDataBinder binder) {
   binder.setDisallowedFields("unitsInOrder", "discontinued");
   } 
  }</code></pre>
  </div>
  </div>
  </p>