struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barry Volpe" <str...@childrencare.com>
Subject Re: DynaAction form and ArrayList
Date Mon, 03 Nov 2003 22:11:14 GMT
Thanks Mark
Your suggestion worked. 

I did not use the 
teacherForm.set("teachers", teacherList);?

It looks like this is accomplished without using
DynaAction Form and using JSTL in my jsp page.

Barry


----- Original Message ----- 
From: "Mark Lowe" <mark.lowe@talk21.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Monday, November 03, 2003 11:42 AM
Subject: Re: DynaAction form and ArrayList


> 
> while(rs.next()) {
> Map teacher = new HashMap();
> teacher.put("firstName",rs.getString("firstName"));
> teacherList.add(teacher);
> }
> 
> teacherForm.set("teachers", teacherList);
> 
> request.setAttribute ("teachers", teacherList.toArray());
> 
> Cheers Mark
> 
> On Monday, November 3, 2003, at 07:35 PM, Barry Volpe wrote:
> 
> >
> >
> > Only Last row is available in my ArrayList?
> >
> > Have the following:
> >
> > ArrayList teachers = new ArrayList();
> > DynaActionForm teacherForm = (DynaActionForm)form;
> >
> > while ( rs.next() ) {
> >
> >
> > System.out.println("firstname.rs: " + rs.getString("firstname"));
> >
> > System.out.println("lastname.rs: " + rs.getString("lastname"));
> >
> > System.out.println("units.rs: " + rs.getString("units"));
> >
> >
> >
> >
> >
> > teacherForm.set("firstname",rs.getString("firstname"));
> >
> > teacherForm.set("lastname",rs.getString("lastname"));
> >
> > teacherForm.set("units",rs.getString("units"));
> >
> >
> >
> >
> > System.out.println("firstname.get: " + teacherForm.get("firstname"));
> >
> > System.out.println("lastname.get: " + teacherForm.get("lastname"));
> >
> > System.out.println("units.get: " + teacherForm.get("units"));
> >
> >
> > teachers.add(teacherForm);
> >
> > }
> >
> > The last row is stored in index 0 and 1.  I expect 0 to be the first 
> > row
> > and 1 to be the second row.
> >
> > System.out.println("teachers[0]: " + teachers.get(0));
> >
> > System.out.println("teachers[1]: " + teachers.get(1));
> >
> > Anyone know why?
> >
> >
> >
> > Thanks,
> >
> > Barry
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message