title: Strange errors for custom tag in JSP file generating dynamic content
body: <p>So I'm working on writing a web program in JSP, and Java servlets using the MVC architecture, where I have to list a bunch of items I retrieve from a database on a JSP page, using a custom forEach tag. I wrote the tag class: </p>
  
  <pre><code>package ps6;
  
  import java.io.*;
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.SimpleTagSupport;
  
  public class ForEachTag extends SimpleTagSupport {
  
      private Object[] items;
      private String attributeName;
  
      public void setItems(Object[] items) {
          this.items = items;
      }
  
      public void setVar(String attributeName) {
          this.attributeName = attributeName;
      }
  
      public void doTag() throws JspException, IOException {
  
          for (int i=0; i &lt; items.length; i++) {
              getJspContext().setAttribute(attributeName, items[i]);
              getJspBody().invoke(null);
          }
      }
  }
  </code></pre>
  
  <p>The .tld file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;taglib xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
      version="2.0"&gt;
      &lt;tlib-version&gt;1.0&lt;/tlib-version&gt;
      &lt;short-name&gt;auction&lt;/short-name&gt;
  
      &lt;tag&gt;
          &lt;description&gt;Outputs a list or something&lt;/description&gt;
          &lt;name&gt;forEach&lt;/name&gt;
          &lt;tag-class&gt;ps6.ForEachTag&lt;/tag-class&gt;
          &lt;body-content&gt;scriptless&lt;/body-content&gt;
  
          &lt;attribute&gt;
              &lt;description&gt;The array of elements&lt;/description&gt;
              &lt;name&gt;items&lt;/name&gt;
              &lt;required&gt;true&lt;/required&gt;
              &lt;rtexprvalue&gt;true&lt;/rtexprvalue&gt;
          &lt;/attribute&gt;
          &lt;attribute&gt;
              &lt;description&gt;The name of the variable to which each entry is assigned&lt;/description&gt;
              &lt;name&gt;var&lt;/name&gt;
              &lt;required&gt;true&lt;/required&gt;   
          &lt;/attribute&gt;
      &lt;/tag&gt;
  &lt;/taglib&gt;
  </code></pre>
  
  <p>The servlet to do the work:</p>
  
  <pre><code>package ps6;
  
  import java.io.*;
  import java.sql.Connection;
  import java.sql.*;
  import javax.servlet.*;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  /**
   * Servlet implementation class ViewAuctions
   */
  @WebServlet("/ViewAuctions")
  public class ViewAuctions extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public ViewAuctions() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          String[][] items = getItems();
          request.setAttribute("items", items);
  
          RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/viewAuctions.jsp");
          dispatcher.forward(request, response);
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
      }
  
      private String[][] getItems() {
  
          try {
              Connection connection = DB.openConnection();
              Statement statement = connection.createStatement();
  
              String query = "SELECT * FROM items WHERE open='1';";
              ResultSet results = statement.executeQuery(query);
  
              results.last();
              int numItems = results.getRow();
              results.first();
              int numCols = 5;
              String[][] items = new String[numItems][numCols];
  
              for (int r=0; r &lt; numItems; r++) {
  
                  items[r][0] = results.getString("itemNum");
                  items[r][1] = results.getString("username");
                  items[r][2] = results.getString("title");
                  items[r][3] = results.getString("description");
                  items[r][4] = results.getString("highBid");
  
                  results.next();
              }
  
              return items;
  
          }
          catch (SQLException sqle) {
              throw new RuntimeException("Error accessing database: " + sqle);
          }
  
      }
  
  }
  </code></pre>
  
  <p>and finally the .jsp file itself: </p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&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;title&gt;See what's for sale&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;%@ taglib uri="/WEB-INF/auction.tld" prefix="auction" %&gt;
  
  &lt;h1&gt;Open Auctions:&lt;/h1&gt;
  
  &lt;table border="1"&gt;
  &lt;tr&gt;&lt;th&gt;Item No.&lt;/th&gt;&lt;th&gt;Auction Owner&lt;/th&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Highest Bid&lt;/th&gt;&lt;/tr&gt;
  &lt;auction:forEach items="${items}" var="row"&gt;
  &lt;tr&gt;&lt;auction:forEach items="${row}" var="data"&gt;
      &lt;td&gt;${data}&lt;/td&gt;
  &lt;/auction:forEach&gt;
  &lt;/tr&gt;
  &lt;/auction:forEach&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>But I keep getting these errors I really don't understand: </p>
  
  <pre><code>org.apache.jasper.JasperException: Unable to compile class for JSP: 
  
  An error occurred at line: 16 in the jsp file: /WEB-INF/viewAuctions.jsp
  Syntax error on token "[", delete this token
  13: 
  14: &lt;table border="1"&gt;
  15: &lt;tr&gt;&lt;th&gt;Item No.&lt;/th&gt;&lt;th&gt;Auction Owner&lt;/th&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Highest Bid&lt;/th&gt;&lt;/tr&gt;
  16: &lt;auction:forEach items="${items}" var="row"&gt;
  17: &lt;tr&gt;&lt;auction:forEach items="${row}" var="data"&gt;
  18:     &lt;td&gt;${data}&lt;/td&gt;
  19: &lt;/auction:forEach&gt;
  
  
  An error occurred at line: 16 in the jsp file: /WEB-INF/viewAuctions.jsp
  Ljava.lang.Object cannot be resolved to a type
  13: 
  14: &lt;table border="1"&gt;
  15: &lt;tr&gt;&lt;th&gt;Item No.&lt;/th&gt;&lt;th&gt;Auction Owner&lt;/th&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Highest Bid&lt;/th&gt;&lt;/tr&gt;
  16: &lt;auction:forEach items="${items}" var="row"&gt;
  17: &lt;tr&gt;&lt;auction:forEach items="${row}" var="data"&gt;
  18:     &lt;td&gt;${data}&lt;/td&gt;
  19: &lt;/auction:forEach&gt;
  
  
  An error occurred at line: 16 in the jsp file: /WEB-INF/viewAuctions.jsp
  Syntax error on token ";", delete this token
  13: 
  14: &lt;table border="1"&gt;
  15: &lt;tr&gt;&lt;th&gt;Item No.&lt;/th&gt;&lt;th&gt;Auction Owner&lt;/th&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Highest Bid&lt;/th&gt;&lt;/tr&gt;
  16: &lt;auction:forEach items="${items}" var="row"&gt;
  17: &lt;tr&gt;&lt;auction:forEach items="${row}" var="data"&gt;
  18:     &lt;td&gt;${data}&lt;/td&gt;
  19: &lt;/auction:forEach&gt;
  
  
  An error occurred at line: 16 in the jsp file: /WEB-INF/viewAuctions.jsp
  The method getValueFromPropertyEditorManager(Class&lt;?&gt;, String, String) in the type JspRuntimeLibrary is not applicable for the arguments ()
  13: 
  14: &lt;table border="1"&gt;
  15: &lt;tr&gt;&lt;th&gt;Item No.&lt;/th&gt;&lt;th&gt;Auction Owner&lt;/th&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Highest Bid&lt;/th&gt;&lt;/tr&gt;
  16: &lt;auction:forEach items="${items}" var="row"&gt;
  17: &lt;tr&gt;&lt;auction:forEach items="${row}" var="data"&gt;
  18:     &lt;td&gt;${data}&lt;/td&gt;
  19: &lt;/auction:forEach&gt;
  
  
  An error occurred at line: 16 in the jsp file: /WEB-INF/viewAuctions.jsp
  Syntax error, insert ")" to complete Expression
  13: 
  14: &lt;table border="1"&gt;
  15: &lt;tr&gt;&lt;th&gt;Item No.&lt;/th&gt;&lt;th&gt;Auction Owner&lt;/th&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Highest Bid&lt;/th&gt;&lt;/tr&gt;
  16: &lt;auction:forEach items="${items}" var="row"&gt;
  17: &lt;tr&gt;&lt;auction:forEach items="${row}" var="data"&gt;
  18:     &lt;td&gt;${data}&lt;/td&gt;
  19: &lt;/auction:forEach&gt;
  </code></pre>
  
  <p>I could really use some help deciphering what these errors mean, or what they're even referring to. The line that it mentions doesn't have the characters it's complaining about, and I don't see where the errors could be coming from, and I haven't been able to find any help through googling the error. Any insight would be greatly appreciated.</p>