Programming struts tags usage
using arraylist and maps
define in your action
List urlName = new ArrayList();
for (Iterator i = st.iterator(); i.hasNext();) {
String str = (String)i.next();
uniqueSet.add(str.substring(0, str.indexOf(".")));
String kstr = str.substring(0, str.indexOf("."));
Map surlName = new HashMap();
surlName.put("url", sysUrlMap.get(kstr));
surlName.put("name", sysNameMap.get(kstr));
urlName.add(surlName);
}
session.setAttribute("uniqueSysSet", uniqueSet);
session.setAttribute("urlNameList", urlName);
in your jsp retrieve the object and use logic iterate to loop over list containing maps
<%
List urlName = (List) session.getAttribute("urlNameList");
pageContext.setAttribute("listurlname", urlName);
%>
<logic:iterate id="urlnamelist" name="listurlname">
<td><a href='<bean:write name="urlnamelist" property="url" />' target="leftFrame"><bean:write name="urlnamelist" property="name" /></a></td>
</logic:iterate>
Comments