Hey Andrew,

   I think that I might have figured this one out.  I am not postive but lets give 
this a try.  In your page you have the following code snippet

pageContext.setAttribute("poassets", assets, PageContext.PAGE_SCOPE);
%>
<table>
     <logic:iterate id="poassets" scope="page" name="myassets" type
="com.dcc.brum.AssetOnPurchaseOrder">
     <tr>
          <td align="left">
               <bean:write name="poassets" property="lineNum" filter
="true"/>
          </td>
          <td align="left">
               <bean:write name="poassets" property="description" filter
="true"/>
          </td>
     </tr>
     </logic:iterate>
</table>

for the line
     <logic:iterate id="poassets" scope="page" name="myassets" type
="com.dcc.brum.AssetOnPurchaseOrder">
I think you should change this to 
     <logic:iterate id="myassets" scope="page" name="poassets" type
="com.dcc.brum.AssetOnPurchaseOrder">

the name attribute is the name of the bean that you saved and you saved your bean to 
the page context as "poassets"
the id attribute is a bean that contains the current element of the collection on each 
iteration.

then for your bean:write lines
               <bean:write name="poassets" property="lineNum" filter
="true"/>
I think you should change this to
               <bean:write name="myassets" property="lineNum" filter
="true"/>

I think this will work for you.  Let me know by replying to me directly as I have 
unsubscribed for the weekend so I don't have 300 mails to read on Monday.

Brian


>>> [EMAIL PROTECTED] 01/24/02 01:42pm >>>
I am trying the most basic iteration I can do on an array and I'm getting
an error.  My bean does have a getter on it so I'm not sure what's
happening.  Am I missing something obvious?  I've included code from the
JSP Page, the error, and the Java Bean.


JSP Page
********
<%
com.dcc.brum.AssetOnPurchaseOrder[] assets = new
com.dcc.brum.AssetOnPurchaseOrder[2];
assets[0] = new AssetOnPurchaseOrder();
assets[0].setLineNum(1);
assets[0].setDescription("5 Ton Hydrolic Lift Truck with...");

assets[1] = new AssetOnPurchaseOrder();
assets[1].setLineNum(2);
assets[1].setDescription("Extra rigging");

pageContext.setAttribute("poassets", assets, PageContext.PAGE_SCOPE);
%>
<table>
     <logic:iterate id="poassets" scope="page" name="myassets" type
="com.dcc.brum.AssetOnPurchaseOrder">
     <tr>
          <td align="left">
               <bean:write name="poassets" property="lineNum" filter
="true"/>
          </td>
          <td align="left">
               <bean:write name="poassets" property="description" filter
="true"/>
          </td>
     </tr>
     </logic:iterate>
</table>

Error
*****
javax.servlet.ServletException: No getter method for property lineNum of
bean poassets
           at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)

           at org.apache.jsp.purchaseOrder$jsp.
_jspService(purchaseOrder$jsp.java:1959)
           at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)



Bean code
************
package com.dcc.brum;

/**
 *
 * @author  AGOODNO
 * @version
 */
public class AssetOnPurchaseOrder implements java.io.Serializable {

    /** Holds value of property lineNum. */
    private int lineNum;

    /** Holds value of property description. */
    private String description;


    /** Creates new AssetOnPurchaseOrder */
    public AssetOnPurchaseOrder() {}



    /** Getter for property lineNum.
     * @return Value of property lineNum.
     */
    public int getLineNum() {
        return lineNum;
    }

    /** Setter for property lineNum.
     * @param lineNum New value of property lineNum.
     */
    public void setLineNum(int lineNum) {
        this.lineNum = lineNum;
    }

    /** Getter for property description.
     * @return Value of property description.
     */
    public String getDescription() {
        return description;
    }

    /** Setter for property description.
     * @param description New value of property description.
     */
    public void setDescription(String description) {
        this.description = description;
    }



Andy

****************************
Andrew Goodnough
Dana Commercial Credit
Programmer


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to