You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Smoak <We...@asu.edu> on 2002/10/08 01:26:45 UTC

Help with displaying contents of a List contained within a bean

I'm plodding along, coding Value Objects and DAO stuff.  I've got a
ResolutionView object, which contains a Person, Address, etc.  I have this:

<table border="1" width="50%">
<logic:iterate id="resView" name="foundPersons" >
  <tr>
    <td align="left">
      <bean:write name="resView" property="key" filter="true"/>
    </td>
    <td align="left">
      <bean:write name="resView" property="preferredName" filter="true"/>
    </td>
     <td align="left">
      <bean:write name="resView" property="preferredAddress" filter="true"/>
    </td>
  </tr>
</logic:iterate>
</table>

The only problem is that resView.getPreferredAddress() actually returns a
List, so the above bean:write tag produces something like: [123 State
Street, Phoenix AZ 12345] which is produced by the toString() method of the
List.

How do I work with the List instead of using bean:write?  I know how to do
it in Java, getting the iterator and iterating to get each value, which in
this case is a line of the address.  Do I need another logic:iterate tag?
(But the "bean" I need isn't in scope, it's inside the current resView
bean!).  An example would be appreciated-- I'm stuck.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management