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 name:StdprdSetCatViewDAOImpl.java  
      
    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();  
               
           try{  
               for( int i=0;i<pg.length;i++)  
               {  
               String qryStr = "select distinct family from spt.catalog";  
               if(pg!=null){  
                   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 (rset.next()){  
                                 
                       colList.add(rset.getString(1));  
                         
                       }  
                   finalList.add(colList);  
               }  
           }catch(SQLException sqlEx){  
               sqlEx.printStackTrace();  
           }  
           finally  
           {  
               PtoolDbUtils.close(rset);  
               PtoolDbUtils.close(pstmt);  
               PtoolDbUtils.close(conn);  
           }                 
         return finalList;  
       }

now in the action class, I will write like this

//Action class name:StdprdSetCatViewAction.java   
      
    StdprdSetCatViewForm sscForm = (StdprdSetCatViewForm) form;  
    StdprdSetCatViewDAO dao = StdprdDAOFactory.getStdprdSetCatViewDAO();  
      
    sscForm.setPriceFamily(dao.getF(pg));

My form bean contains following property

//name of the formbean:StdprdSetCatViewForm.java  
      
    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"/>  
                   </html:select>  
     
   </logic:iterate>  
   </logic:iterate>

This code might help you.

MyColl.java
==========

package com.me;
....
...

public class MyColl extends ActionSupport{
  
  private List my;
  
  public String execute()throws Exception{
    my = new ArrayList();
    my.add("India");
    my.add("Pak");
    my.add("Lanka");
    return SUCCESS;
  }

  public List getMy(){
    return my;
  }
}

sample.jsp

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

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

struct-config.xml entry

...
<action name="MyColl" class="com.me.MyColl">
      <result>/sample.jsp</result>
</action>
...

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">
        </logic:iterate> 
</logic:iterate>

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

This article has been dead for over six months. Start a new discussion instead.