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>