Iterate through a hastable in struts

T

thenrick

I want to be able to print out what I have in my form's hashtable.
Here is some of the Java code.

ArrayList reportArray = new ArrayList();
Hashtable reportDetail = new Hashtable();

try {
connection = TomcatConn.newInstance().getConnection("jdbc/main");
dynamicStatement = connection.prepareStatement(report_sql);
log.debug(report_sql);
rs = dynamicStatement.executeQuery();
int colCount = rs.getMetaData().getColumnCount();

grp = new Group();

while (rs.next()) {
grp.setGroupName(rs.getString(1));
grp.setDescription(rs.getString(2));
grp.setParentGroup(rs.getString(3));

reportArray.add(rs.getString("Role"));
reportArray.add(rs.getString("System"));
reportArray.add(rs.getString("Application"));

reportDetail.put(grp,reportArray);

}
form.setReportDetail(reportDetail);

I can print out the data but it all comes at once. I want to be able
to parse it out.
Here is the JSP code I have that prints out this portion.

<logic:notEmpty name="fetchReport" property="reportDetail">
<logic:iterate name="fetchReport" property="reportDetail"
id="reportDetail" >
<logic:iterate name="fetchReport" property="reportDetail" id="group" >
<tr><td><bean:write name="group" />
</td><td><bean:write name="reportArray" /></td></tr>
</logic:iterate>
</logic:iterate>
</logic:notEmpty>

I would like to print out
Group Name Description
Parent Group

Then iterate through the arraylist while the key is the same.
Role System application
..
..
..
Thanks in Advance,
Tom Henricksen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top