aspose file tools*
The moose likes Struts and the fly likes logic:iterate HashMap<Object,ArrayList> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:iterate HashMap<Object,ArrayList>" Watch "logic:iterate HashMap<Object,ArrayList>" New topic
Author

logic:iterate HashMap<Object,ArrayList>

Nick Gatsis
Greenhorn

Joined: Sep 19, 2009
Posts: 3
Hello,

I am trying to iterate through a HashMap<RecmExclusionCntctReasonKey,ArrayList<ContactReasonInfo>> using logic:iterate.

The error I am receiving is:
javax.servlet.jsp.JspException: No collection found.

Here is my JSP:
<logic:iterate id="recmExclusionCntctReasonKey" property="recmExclContactReasonMap" name="requestContainerForm">
<tr>
<logic:equal name="requestContainerForm" property="readOnly" value="false">
<td><html:select property="key" name="recmExclusionCntctReasonKey" indexed="true">
<htmlptionsCollection name="requestContainerForm" property="recmData.chanOrgList" label="description" value="code" />
</html:select></td>
<td>
<div id="tableContainer" class="tableContainer">
<table width="100%" height="5%" align="center" class="scrollTable" id="assignedTable">
<tbody class="scrollContent">
<logic:iterate id="recmExclContactReasons" name="requestContainerForm" property="recmExclContactReasonMap.value" type="java.util.ArrayList" indexId="iExclRsns">
<tr>
<td width="5%" align="left"> <html:checkbox name="recmExclContactReasons" property="checkedExclusionReason" indexed="true"></html:checkbox></td>
<td align="left"> <html:text name="recmExclContactReasons" property="contactReasonDesc" indexed="true" readonly="true" maxlength="30" size="30"/></td>
</tr>
</logic:iterate>
</tbody>
</table>
</div>
</td>
</logic:equal>
</tr>
</logic:iterate>

Here's what is in RequestContainerForm:
private HashMap<RecmExclusionCntctReasonKey,ArrayList<ContactReasonInfo>> recmExclContactReasonMap = new HashMap<RecmExclusionCntctReasonKey,ArrayList<ContactReasonInfo>>();

public RecmExclusionCntctReasonKey getRecmExclusionCntctReasonKey(int index) {
if (this.recmExclContactReasonMap == null) {
this.recmExclContactReasonMap = new HashMap<RecmExclusionCntctReasonKey,ArrayList<ContactReasonInfo>>();
}
while (index >= recmExclContactReasonMap.size()) {
recmExclContactReasonMap.put(new RecmExclusionCntctReasonKey(),RecommendationLoader.toContactReasonInfo(getRecmData().getContactReasonList()));
}
ArrayList<RecmExclusionCntctReasonKey> aList = new ArrayList<RecmExclusionCntctReasonKey>(this.recmExclContactReasonMap.keySet());

return (aList.get(index));
}

public HashMap<RecmExclusionCntctReasonKey, ArrayList<ContactReasonInfo>> getRecmExclContactReasonMap() {
return recmExclContactReasonMap;
}

public void setRecmExclContactReasonMap(
HashMap<RecmExclusionCntctReasonKey, ArrayList<ContactReasonInfo>> recmExclContactReasonMap) {
this.recmExclContactReasonMap = recmExclContactReasonMap;
}

And here's what is in RecmExclusionCntctReasonKey
private String chanBusOrgCde = "";
private String effDt = "";
private String expDt = "";

with appropriate getters, setters, hashCode, and equals by chanBusOrgCde.


I see the populated HashMap before Struts does the "forward", so I know the data is there. Any help would be greatly appreciated.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

Nick please Use Code Tags when you post a source code. That way your code looks formatted. Unformatted code is hard to read. You can add code tags by wrapping your code in [code] [/code] tags. You can edit your message using button and then add code tags to it...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Nick Gatsis
Greenhorn

Joined: Sep 19, 2009
Posts: 3
Can't seem to locate the Edit message button, so I will post the message again as a reply.
Hello,

I am trying to iterate through a HashMap<RecmExclusionCntctReasonKey,ArrayList<ContactReasonInfo>> using logic:iterate.

The error I am receiving is:
javax.servlet.jsp.JspException: No collection found.

Here is my JSP:


Here's what is in RequestContainerForm:


And here's what is in RecmExclusionCntctReasonKey with appropriate getters, setters, hashCode, and equals by chanBusOrgCde.


I see the populated HashMap before Struts does the "forward", so I know the data is there. Any help would be greatly appreciated.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: logic:iterate HashMap<Object,ArrayList>