Guys, I am stuck , where I am not able to find out the way to display the ArrayList of ArrayList in jsp page.
So if possible Please help me.
My code in DAO class is as under

//DAO class  
    public ArrayList getF(String[] pg) throws Exception {  
    //pg is nothing but Array of String , which is used for select perticular row from database  
            Connection conn = null;  
           PreparedStatement pstmt = null;  
           ResultSet rset = null;  
           ArrayList finalList = new ArrayList();  
           StdprCommonFuncs common = new StdprCommonFuncs();  
               for( int i=0;i<pg.length;i++)  
               String qryStr = "select distinct family from spt.catalog";  
                   qryStr = qryStr + " where product='"+pg[i]+"' order by 1 for read only";  
               Global.println("qryStr" + qryStr);  
               conn = PtoolDbUtils.getConnection();  
               pstmt = conn.prepareStatement(qryStr);  
               rset = pstmt.executeQuery();  
               ArrayList colList = new ArrayList();  
                   while ({  
           }catch(SQLException sqlEx){  
         return finalList;  

now in the action class, I will write like this

//Action class   
    StdprdSetCatViewForm sscForm = (StdprdSetCatViewForm) form;  
    StdprdSetCatViewDAO dao = StdprdDAOFactory.getStdprdSetCatViewDAO();  

My form bean contains following property

//name of the  
    private ArrayList priceFamily;  
    public ArrayList getPriceFamily() {  
            return priceFamily;  
       public void setPriceFamily(ArrayList priceFamily) {  
           this.priceFamily = priceFamily;  

So now I want to print this Arraylist of Arraylist in jsp page , but i am unable to proceed so please give me suggestions.
Also I want to use tags only ,no scriptlets.

So should i write in my jsp page something like this...  
   <logic:iterate name="StdprdSetCatViewform" property="priceFamily">  
    <logic:iterate id="??" name="??" property="??">  
   <html:select property="selectedPriceFamily" styleId="selectedPriceFamily" styleClass="iform" size="5" multiple="multiple" >  
                       <html:option value="ALL">Select price famili(s)</html:option>  
                       <html:options property="priceFamily" name="stdprdSetCatViewForm"/>  

Recommended Answers

All 3 Replies

This code might help you.


public class MyColl extends ActionSupport{
  private List my;
  public String execute()throws Exception{
    my = new ArrayList();
    return SUCCESS;

  public List getMy(){
    return my;


<%@ taglib prefix="s" uri="/struts-tags" %>

      <s:iterator value="my">
        <s:property />

struct-config.xml entry

<action name="MyColl" class="">

r u using struts 1.2???
In struts 1.2 it will like this

<logic:iterate name="arrayListName" id="someId">
      <logic:iterate name="arrayListName"  property="nestedArrayListNme"  id="someId">
      <bean:write name="someId" property="name">

here name might be your javabean property

Hey DATAPOST, thanks for yor suggestion but I think my case is more complex and different from what u suggested but , thanks for yor effort , I appreciate it.

@Mamata, thanks to u as well.
Yor suggestion is quite right , and I think i can solve it by that way, thanks for help and reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.