• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

logic:iterate HashMap<Object,ArrayList>

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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">
<html:optionsCollection 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.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Nick Gatsis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic