title: How to get array list size in java jsp?
body: <p>I have a form that ask for user to enter ID. This form is send to a servlet which checks database to see if user exist. If the user exists then it sends me back their ordered items. The ordered items are returned as an array list. Then this array list is redirect to jsp file to display it on the webpage. The user can have more then one order, therefore the array list size can vary. How do I get the array list size so i can display each item in the array list? I do not want to use JSTL.</p>
  
  <p>index.jsp:</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;JSP Page&lt;/title&gt;
  &lt;script&gt;
      /*function signin(id, id2) {
       document.getElementById(id).style.display = 'block';
       document.getElementById(id2).style.display = 'none';
       //document.getElementById(id3).style.display = 'none';
       }*/
  &lt;/script&gt; 
  </code></pre>
  
  <p>
  </p>
  
  <pre><code>&lt;form id="Signin" method="post" action="FindUser"&gt;
      &lt;h2&gt;Login &lt;/h2&gt;
      &lt;input type="text" name="txtCustID" 
             placeholder="UserID"&gt;&lt;br&gt;
      &lt;br&gt;&lt;input type="submit" value="Find"&gt;
  &lt;/form&gt;
  &lt;%--!&lt;form id="Signup" method="post" action="FindUser" 
        style="display:none;"&gt;
      &lt;h2&gt;Sign Up &lt;/h2&gt;
      &lt;input type="text" name="UserId" 
             placeholder="User ID"&gt;&lt;br&gt;
      &lt;br&gt;&lt;input type="text" name="FirstaName" 
                 placeholder="First Name"&gt;&lt;br&gt;
      &lt;br&gt;&lt;input type="text" name="LastName" 
                 placeholder="Last Name"&gt;&lt;br&gt;
      &lt;br&gt;&lt;input type="text" name="Street" 
                 placeholder="Street"&gt;&lt;br&gt;
      &lt;br&gt;&lt;input type="text" name="City" 
                 placeholder="City"&gt;&lt;br&gt;
      &lt;br&gt;&lt;input type="submit" value="Sign Up"&gt;
  &lt;/form&gt; --%&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>FindUser.java:</p>
  
  <pre><code>public class FindUser extends HttpServlet {
  
  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse
      response) throws ServletException, IOException {
  
  
  String sID = request.getParameter("txtCustID");
  
  String url = ("admin/UserFound.jsp");
  try {
      Users one = UserDAO.findUser(sID);
      request.setAttribute("theCustomer", one);
      if (one.getFirstName().equals("none")) {
          url = "admin/UserNotFound.jsp";
      }
      ArrayList user_order = UserDAO.findOrder(sID);
      request.setAttribute("theOrder", user_order);
      response.sendRedirect(url);
      //RequestDispatcher rd = request.getRequestDispatcher(url);
      //rd.forward(request, response);
  
  } catch (ClassNotFoundException e) {
      System.err.print("Failed to load Driver");
      System.err.print(e);
  } catch (SQLException e) {
      System.err.print("SQL Error" + e);
      System.err.print("SQL State: " + e.getSQLState());
      System.err.print("Error Code: " + e.getErrorCode());
  } catch (Exception e) {
      System.err.println(e);
  }
  }
  </code></pre>
  
  <p>UserFound.jsp:</p>
  
  <pre><code>&lt;%-- 
  Document   : CustomerFound
  Created on : Nov 15, 2014, 9:40:47 PM
  Author     : mississauga
  --%&gt;
  
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;JSP Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  
  &lt;p&gt;First word is: ${theOrder[x].getBoxes()}&lt;/P&gt;
  
  &lt;%--&lt;form id="Signin" method="post" action="FindUser" 
         style="display:none;"&gt;
       &lt;h2&gt;Login &lt;/h2&gt;
       &lt;input type="text" name="txtCustID" 
              placeholder="UserID"&gt;&lt;br&gt;
       &lt;br&gt;&lt;input type="submit" value="Find"&gt;
   &lt;/form&gt; --%&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  }
  </code></pre>