Arraylist and Struts...need some ideas
Hi...
Now i develop small web application using struts. Currently i got problem for my bean class. I don't know how to describe my problem but it related to different objects store in arraylist and another one how to display the arraylist at jsp page.
Below is my class existing class
private List fillContactList (ResultSet rs)
{
List contactList = new ArrayList ();
try
{
while( rs.next () )
{
ContactForm bean = new ContactForm ();
bean.setContactID (rs.getInt ("contactID"));
bean.setName (rs.getString ("name"));
bean.setPhone (rs.getString ("phone"));
bean.setEmail (rs.getString ("email"));
bean.setCompanyID (rs.getInt ("companyID"));
contactList.add (bean);
}
}
catch(Exception e)
{ System.out.println (e) ; }
return contactList;
}
I have no problem with above class. Actually i need to create another function like above which is the resultset will contains 2 or more tables.
So if the resultset contains more than 1 table, i need to create object for another bean's class such:
Car carBean = new Car();
Advert advertBean = new Advert();
and store the data to bean like
carBean.setXXX (rs.getXXX ("XXX"));
So i got problem how to store all object in arraylist like
contactList.add (bean) and how i want to call the object from jsp page by using logic tag or other tag?

