title: How do I pass a bean to a JSP tag as a parameter?
body: <p>I've created a custom JSP tag that is supposed to accept a list of products to render, but I'm having trouble figuring out how to pass the list to the tag. The product list exists as a page-scoped bean. The web app is written in Struts 1.2.x using the <a href="http://struts.apache.org/1.2.9/userGuide/struts-bean.html" rel="nofollow">Struts taglib</a>.</p>
  
  <p>Here's a simplified version of my code:</p>
  
  <h3>renderProducts.tag</h3>
  
  <pre><code>&lt;%@ tag language="java" pageEncoding="ISO-8859-1" body-content="empty" %&gt;
  &lt;%@ attribute name="products" required="false" type="ProductIf[]" %&gt;
  &lt;logic:iterate id="product" name="${products}" type="ProductIf"&gt;
      &lt;!-- Render the product --&gt;
  &lt;/logic:iterate&gt;
  </code></pre>
  
  <h3>ProductDetail.jsp</h3>
  
  <pre><code>&lt;bean:define id="relatedProducts" name="productMgr" property="relatedProducts /&gt;
  &lt;my:renderProducts products="${relatedProducts}" /&gt;
  </code></pre>
  
  <p>However, when I view the page, I get an exception:</p>
  
  <blockquote>
    <p>Unable to convert string "${relatedProducts}" to class "[Lcom.foo.ProductIf;" for attribute "products": Property Editor not registered with the PropertyEditorManager</p>
  </blockquote>
  
  <p>So it seems the <code>${}</code> syntax is not what I need to be doing, since it is being interpreted as a literal string anyway. I've also tried passing in the name of the bean without the <code>${}</code> with the same result. What is the proper syntax?</p>
  
  <p>(Note: Please forgive me if this question is built on a shaky foundation of bad assumptions, but I'm new to Java EE development and there's a fair amount of fumbling-in-the-dark going on.)</p>