Are you doing nested ArrayLists?

If so then try something like:
<html>
  <body>
    Use of the Struts iterate tag with nested ArrayLists representing rows/cols:<p>
    <%@ page import="java.util.ArrayList" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

    <%
      ArrayList rows = new ArrayList(); 
      ArrayList rowOne = new ArrayList();
      rowOne.add("bob");
      rowOne.add("jones");
      rowOne.add("[EMAIL PROTECTED]");
      ArrayList rowTwo = new ArrayList();
      rowTwo.add("ted");
      rowTwo.add("Walters");
      rowTwo.add("[EMAIL PROTECTED]");
      ArrayList rowThree = new ArrayList();
      rowThree.add("Mary");
      rowThree.add("Smith");
      rowThree.add("[EMAIL PROTECTED]");

      rows.add(rowOne);
      rows.add(rowTwo);
      rows.add(rowThree);

      request.setAttribute("DATASET",rows);
    %>
    <table border="1">
      <logic:iterate id="eachRow" name="DATASET" scope="request">
        <tr>
           <logic:iterate id="eachCol" name="eachRow">
             <td>
               <bean:write name="eachCol" />
             </td>
           </logic:iterate>
        </tr>
      </logic:iterate>
    </table>
  </body>
</html>


If not, then try this:
<html>
  <body>
    Use of the Struts iterate tag:<p>
    <%@ page import="java.util.ArrayList" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

    <%
      ArrayList myList = new ArrayList();
      myList.add("Item One");
      myList.add("Item Two"); 
      myList.add("Item Three");
      request.setAttribute("MYLIST",myList);
    %>
    <table>
      <logic:iterate id="row" name="MYLIST" scope="request">
      <tr><td>
        <bean:write name="row" />
      </td></tr>
      </logic:iterate>
    </table>
  </body>
</html>

Sorry for the excessive code, but these do work.

Hope that helps.

-- Geoff

> thanks for the fast reply but...
> for example:
> listClients - collection of client's
> objects(ArrayList for example)
> client - object
> code - client object property
> 
> i want write code in html form.
> how can i do it?
> 
> -----Mensagem original-----
> De: Olivier Dinocourt
> [mailto:[EMAIL PROTECTED]]
> Enviada em: quinta-feira, 10 de janeiro de 2002 11:56
> Para: Struts Users Mailing List
> Assunto: Re: <bean:write.../>
> 
> 
> <bean:write name="..." property="pty[index]" />
> 
> hope I'm not wrong.... :)
> 
> ----- Original Message -----
> From: "Rubens Gama" <[EMAIL PROTECTED]>
> To: "Struts-User" <[EMAIL PROTECTED]>
> Sent: Thursday, January 10, 2002 2:52 PM
> Subject: <bean:write.../>
> 
> 
> > How can i write an object's property that belongs
> to an 'ArrayList' object
> > using the clause <bean:write.../>?
> >
> > Thanks in advance
> >
> >
> >
> > --
> > 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]>
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


--
Sent via jApache.org

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

Reply via email to