I've been working on this <bean:iterate ... > problem for some time now.  I
finally had to use a scriplet to get it to work.  I am trying to get a list
of FieldTypes from a record controller (PrimaryServer below) which implement
an AbstractField object (this may be the entire problem ... let me know if
Abstract objects will cause problems).  The controller has a method called
getFieldList which returns an Iterator of these AbstractField objects.  I
then want to get the name of each field using the property getFielName().
The following is a snippet of my Jsp page.  Tomcat always returns with an
error saying it "can't find bean 'field' in scope null".

<logic:iterate id="field" name="PrimaryServer" property="fieldList"
type="com.iic.dbsync.IntField">
  <tr>
    <td align="center"> <jsp:getProperty name="PrimaryServer"
property="fieldList"/>
              <bean:write name="field" property="fielName"/> </td>
    <td> <html:text property="field2" size="100"  /></td>
  </tr>
</logic:iterate>

Here is the scriplet that I wrote to finally get the results that I wanted.


<% Iterator iter = PrimaryServer.getFieldList();
    while( iter.hasNext() ) {
        AbstractField field = (AbstractField) iter.next();
        String fieldName = field.getFieldName();
%>
  <tr>
    <td align="center"> <%=fieldName%> </td>
    <td> <html:text property="field2" size="100" /></td>
  </tr>
<%    }
%>

The iterator tag still trips me up from time to time.  If anyone has any
suggestions I would appreciate them.  I have enjoyed reading the previous
postings concerning the iterator tag.

Thanks again,

Brett


Reply via email to