Sunday, 1 September 2013

java collection usage as map and retrieving data

java collection usage as map and retrieving data

Map<String, List<OfferBean>> map = new HashMap<String, List<OfferBean>>();
List<OfferBean> al=new ArrayList<OfferBean>();
OfferBean of=null;
sql="select * from catgory";
ps1=c.prepareStatement(sql);
ps1.execute();
rs=ps1.getResultSet();
if(rs.next())
{
System.out.println("inside loop of if");
sql="select * from catgory";
ps1=c.prepareStatement(sql);
ps1.execute();
rs=ps1.getResultSet();
while(rs.next())
{
of=new OfferBean();
System.out.println("inside loop of while");
of.setCategory(rs.getString("catgoryname"));
al.add(of);
}
map.put("key", al);
i want use two array list the both array list i will put inside map by
using key and i want to pass to the jsp side in the jsp side i want
retrieve the data using jstl how to reteive it plz any one help me

No comments:

Post a Comment