title: JSTL - iterating through array of random integers - not displaying in webPage
body: <p>I'm trying to iterate through myList (array) of random generated integers using JSP/JSTL. 
  My code snipet which generates and stores integers, is located in my servlet.</p>
  
  <p>On the other hand,iterating through an arrayList of Strings (see code below) works perfectly but when i try it with arrays based on the same logic, my webpage just doesnt show any unordered list of my random integers. </p>
  
  <p>thank you for helping me out</p>
  
  <p>My Servlet</p>
  
  <pre><code>package be.intec.servlets;
  
      import java.io.IOException;
      import java.math.BigDecimal;
      import java.util.ArrayList;
      import java.util.Arrays;
      import java.util.LinkedHashMap;
      import java.util.List;
      import java.util.Map;
  
      import javax.servlet.RequestDispatcher;
      import javax.servlet.ServletException;
      import javax.servlet.annotation.WebServlet;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
  
      import be.intecbrussel.entities.Auto;
  
      @WebServlet("/JSTLServlet")
      public class JSTLServlet extends HttpServlet {
  
          private static final long serialVersionUID = 1L;
  
          private static final String VIEW = "WEB-INF/JSP/JSTL.jsp";
  
          protected void doGet(HttpServletRequest request,
                  HttpServletResponse response) throws ServletException, IOException {
  
              RequestDispatcher dispatcher = request.getRequestDispatcher(VIEW);
  
              //=======below is the code using Array=====================================
              int[] myList = new int[42];
              for (int i = 0; i &lt; myList.length; i++) {
                  myList[i] = (int) (Math.random() * 100);
              }
              request.setAttribute("mylist", myList);
  
              //=======below is the code using ArrayList=====================================
  
  
              List&lt;String&gt; names = Arrays.asList("John", "Georges", "Kevin");
  
              request.setAttribute("names", names);
  
              dispatcher.forward(request, response);      
          }
  
      }
  </code></pre>
  
  <p>My jstl.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1" session="false"%&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&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;link rel="stylesheet" type="text/css" href="styles/default.css"&gt;
  
  
  &lt;title&gt;JSTL Expample&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;h2&gt;Iterate through my array&lt;/h2&gt;
  
      &lt;ul&gt;
          &lt;c:forEach var="arrayVar" items="${myList}"&gt;
  
              &lt;li&gt;${arrayVar}&lt;/li&gt;
  
  
          &lt;/c:forEach&gt;
  
      &lt;/ul&gt;
  &lt;!-- ================================================================================ --&gt;
  
      &lt;h2&gt;Iterate through my arrayList&lt;/h2&gt;
  
      &lt;ul&gt;
          &lt;c:forEach var="name" items="${names}"&gt;
  
              &lt;li&gt;${name}&lt;/li&gt;
  
          &lt;/c:forEach&gt;
      &lt;/ul&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>my 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_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
    &lt;display-name&gt;ServletsAndJSPExampleProject&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;IndexServlet&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>my index Servlet</p>
  
  <pre><code>package be.intec.servlets;
  
  import java.io.IOException;
  
  import javax.servlet.RequestDispatcher;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  @WebServlet("/IndexServlet")
  public class IndexServlet extends HttpServlet {
  
      private static final long serialVersionUID = 1L;
  
      private static final String VIEW = "/WEB-INF/JSP/index.jsp";
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          RequestDispatcher dispatcher = request.getRequestDispatcher(VIEW);
  
          dispatcher.forward(request, response);
  
      }
  
  
  }
  </code></pre>
  
  <p>Output in Browser is :</p>
  
  <p>Iterate through my array: 
  // here it should be showing my random numbers</p>
  
  <p>Iterate through my arrayList:
  // work very well</p>
  
  <ul>
  <li><p>John</p></li>
  <li><p>Georges</p></li>
  <li><p>Kevin</p></li>
  </ul>