Could I suggest you slow down & do some study & experimentation? Struts is hard work in the early stages, but you have to go thru it. >From a very quick look one thing is your ArrayList needs to contain a class that has get/set methods for it's properties. You've set them like m.id="123"; m.name="John"; when it should be m.setId("123"); & struts will call the String getId() methoid to get the value to display.
Also in the iterate tag's type=... you must specify the type of the object in each elemnt of your ArrayList ie/ type="MyClass". --- Henry Lu <[EMAIL PROTECTED]> wrote: > I don't remember the error exactly but something like Servlet errors. > > > --------------------------------------------------------------------------- > Henry Lu > MCIT phone: (734) 936-2063 > University of Michigan Medical Center fax: (734) 763-4372 > > On 19 Feb 2002 [EMAIL PROTECTED] wrote: > > > Can you give me a little more info about the error ?? > > > > On Tue, 19 Feb 2002 08:30:40 -0500 (EST) Henry Lu <[EMAIL PROTECTED]> wrote: > > >Could someone tell me why the following code doesn't work? How to make it > > >work? > > > >//////////////////////////////////////////////////////////////////////////// > > >public class MyClass_1 > > >{ > > >... > > >} > > >/////////////////////////////////////////////////// > > >public class MyClass_2 extends MyClass_1 > > >{ > > > ... > > > public ArrayList runList() > > > { > > > Arraylist lst = new ArrayList(); > > > MyClass m; > > > > > > m.id="123"; > > > m.name="John"; > > > lst.add(m); > > > > > > return lst; > > > } > > >} > > >/////////////////////////////////////////////////// > > >public class MyForm extends ActionForm > > >( > > > ... > > > private ArrayList lst; > > > public ArrayList getLst() > > > { > > > MyClass_2 m2; > > > this.lst = m2.runList(); > > > return this.lst; > > > } > > > public void setLst(ArrayList lst) > > > { > > > this.lst = lst; > > > } > > >} > > >////////////////////////////////////////////////////////////// > > ><table> > > > > > ><logic:iterate id="theList" > > > name="MyForm" property="lst" > > > type="MyClass_2"> > > ><tr><td> > > ><bean:write name="theList" property="id"/> > > ></td><td> > > ><bean:write name="theList" property="name"/> > > ></td></tr> > > > > > ></logic:iterate> > > > > > ></table> > > >//////////////////////////////////////////////////////////////// > > > > > > > > > >--------------------------------------------------------------------------- > > >Henry Lu > > >MCIT phone: (734) 936-2063 > > >University of Michigan Medical Center fax: (734) 763-4372 > > > > > > > > >-- > > >To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > >For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > -- > > Get your firstname@lastname email at http://Nameplanet.com/?su > > > > -- > > 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]> > __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>