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);
我想使用两个
ArrayList
这两个ArrayList
我将通过使用密钥放入HashMap
中,并且我想传递到jsp
端的jsp
端,我想使用jstl
检索数据reteive it plz任何人都可以帮助我 最佳答案
request.setAttribute("myMap", map);
<c:forEach items="${myMap}" var="mapEntry">
key : ${mapEntry.key}
<c:forEach items="${mapEntry.value}" var="item">
Category : ${item.category}
</c:forEach><br>
<c:forEach>