Nick Gatsis

Greenhorn
+ Follow
since Sep 19, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Nick Gatsis

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.


15 years ago
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.
15 years ago
Hello. This is my first time on this forum and unfortunately I don't have example code to illustrate my problem, so I have a rather lengthly explanation. Please look at it as I have been rocking my brains for a week now. Thanks.

1) parent and child have own Action and ActionForm classes, all with scope=request; scope=session is not really an option.
2) parent JSP that renders parent ActionForm contains 5 elements:
1) text box to enter a group name
2) text box for effective date
3) text box for expiration date
4) <table> with <logic:iteration id="assgndAM" index="iAssgndAM"> to render contents of ArrayList<AccountManager>. This ArrayList is an instance variable on the parent ActionForm bean and uses Lazy List processing to automatically grow the ArrayList. This is done when parent ActionForm is loaded the first time and subsequent times.
a) four fields displayed: <html:checkbox>, and 3 text boxes.
5) <input type=button onclick=addToGroup()>
a) JavaScript linked to parent JSP that opens a new window and passing "childAction.do" and a string concatenation of all the elements to be displayed.
b) string parameter of all elements is loaded into ArrayList of the child ActionForm bean when childAction is called.
3) child JSP that renders child ActionForm contains three elements
1) <table> with <logic:iteration id="assgnAbleAM" index="iAssgnAbleAM">. This too is an ArrayList<AccountManager> as a instance variable on the child ActionForm bean.
a) three fields displayed in table: <html:checkbox>, and two text boxes.
2) <input type=button value="Add" name="Add onClick="addManagers()">
a) user presses button and passes all the items checked from table as a string to parent Action using document.form.action=parentAction.do. Parent Action grows and loads ArrayList<AccountManager> with string parameter contents.
3) <input type=button value="Cancel"> closes the popup window.
4) process flow:
1) user goes to parent JSP and enters data in text boxes.
2) user presses "Add To Group" button on parent JSP which launches child popup window.
3) user checks people to add to group and presses "Add" button on child popup window. Popup closes.
4) parent JSP now shows items checked from child window.
5) user presses "Add To Group" button on parent JSP again to add more.
5) problem is on subsequent adds because of scope=request, new parent ActionForm is being created and ArrayList<AccountManager> is empty. However, the three other instance variables, which are associated to the text boxes on the main JSP, are populated on parent ActionForm bean. Bottom line, I am losing the contents of the ArrayList<AccountManager> everytime after the first time when going from child to parent.






15 years ago