title: Retrieving the value of a java array in jsp
body: <p>I have a java method that returns a String array.
  Also there is a jsp page which has an array variable. How do I assign this jsp variable with the value returned by the java method?</p>
  
  <p>I tried,</p>
  
  <p><code>&lt;c:set var="list" value="&lt;%= engine.getList(); %&gt; "/&gt;</code></p>
  
  <p>where <code>engine</code> is the java object. But this is not working. No values are getting stored.</p>
  
  <h2>Java Code:</h2>
  
  <pre><code>public String[] getCatEntId() {
      ArrayList&lt;String&gt; catEntIdArrList = new ArrayList&lt;String&gt;();
      Statement stmnt = null;
      String itemUrl = null;
      int i = 0;
  
      String sql = "SELECT * FROM ITEM WHERE ITEMID LIKE '%it%'";
  
      try {
          stmnt = getMySqlDbConn().createStatement();
          ResultSet rs = stmnt.executeQuery(sql);
  
          while (rs.next()) {
              itemUrl = rs.getString(1);
              String catalogId = itemUrl.substring((itemUrl.indexOf("productId=") + 10), (itemUrl.indexOf("productId=") + 15));
              System.out.println("Catalog Id : " + catalogId);
              catEntIdArrList.add(catalogId);
              i++;
          }
      } catch (SQLException e) {
          e.printStackTrace();
      } 
  
      return catEntIdArrList.toArray(new String[catEntIdArrList.size()]);
  }
  </code></pre>
  
  <p>Any help would be appreciated!!!</p>