I had the same issue.
Here's the fix:
Move your declaration before the forEach loop.
<jsp:useBean id="paramMap" class="java.util.HashMap" scope="page">
</jsp:useBean>
> <c:forEach var="topMenuItem" items="${topMenu}">
>
> <c:choose>
> <c:when test="${topMenuItem.menuItemName eq currentPageName}">
> <td valign="bottom" align="right" class="tabselected">
> <img src="<c:out
value="${commonImagePath}/page_name_left_selected.gif"/>" border="0">
...
...
> <c:otherwise>
> <c:set target="${paramMap}" property="pageName"
value="${topMenuItem.menuItemName}"/>
> <c:set target="${paramMap}" property="menuBlock"
value="${topMenuItem.link}"/>
>
> <td valign="bottom" align="right" class="tabunselected">
...
...
With each iteration, the set will overwrite the previous
values.....done.
--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx
> -----Original Message-----
> From: Joanne L Corless [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 16, 2003 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: Using jsp:useBean within a c:forEach loop - Having problems
>
>
> Hi,
>
> I am building an application based around struts that needs a
> number of
> html:link's building in the JSP. I have successfully built the
> functionality using a single parameter, however I need to use multiple
> parameters passed into the struts action.
>
> It is sort of working using a jsp:useBean and setting the parameters,
> however this works only for the first object in the list. All
> the other
> item's in the list display the correct name but the
> parameters are the same
> as the first object.
>
> Is this because the bean has been set into the page scope and
> if it is how
> can I fix this ?
>
> The code in the page is below:
>
> <c:forEach var="topMenuItem" items="${topMenu}">
>
> <c:choose>
> <c:when test="${topMenuItem.menuItemName eq currentPageName}">
> <td valign="bottom" align="right" class="tabselected">
> <img src="<c:out value="
> ${commonImagePath}/page_name_left_selected.gif"/>" border="0">
> </td>
> <td valign="bottom" background="<c:out value="
> ${commonImagePath}/page_name_mid_selected.gif" />"
> align="center" class
> ="tabselected" nowrap style="background-repeat: repeat-x;">
> <span class="tabselected"><c:out value="
> ${topMenuItem.menuItemName}"/></span>
> </td>
> <td valign="bottom" align="left" class="tabselected">
> <img src="<c:out value="
> ${commonImagePath}/page_name_right_selected.gif"/>" border="0">
> </td>
> </c:when>
> <c:otherwise>
> <jsp:useBean id="paramMap" class="java.util.HashMap"
> scope="page">
> <c:set target="${paramMap}" property="pageName" value="
> ${topMenuItem.menuItemName}"/>
> <c:set target="${paramMap}" property="menuBlock" value="
> ${topMenuItem.link}"/>
> </jsp:useBean>
>
> <td valign="bottom" align="right" class="tabunselected">
> <html:link action="/changePage"
> name="paramMap">
> <img src="<c:out value="
> ${commonImagePath}/page_name_left_unselected.gif"/>" border="0">
> </html:link>
> </td>
> <td valign="bottom" background="<c:out value="
> ${commonImagePath}/page_name_mid_unselected.gif" />"
> align="center" class
> ="tabselected" nowrap style="background-repeat: repeat-x;">
> <html:link action="/changePage"
> name="paramMap">
> <span class="tabselected"><c:out value="
> ${topMenuItem.menuItemName}"/></span>
> </html:link>
> </td>
> <td valign="bottom" align="left" class="tabunselected">
> <html:link action="/changePage"
> name="paramMap">
> <img src="<c:out value="
> ${commonImagePath}/page_name_right_unselected.gif"/>" border="0">
> </html:link>
> </td>
> </c:otherwise>
> </c:choose>
> </c:forEach>
>
> I would really appreciate some help with this
>
> Regards
>
> Joanne Corless
>
> CSC Computer Sciences Limited
> (�� Office +44 (0)1772 318025
> ( Mobile +44 (0)7767 656588
> * email [EMAIL PROTECTED]
>
>
> Based at: CSC, Alliance House, Library Road, Chorley, Lancs, PR6 7EN
> CSC Computer Sciences Limited: Registered in England, No. 963578.
> Registered office: Royal Pavilion, Wellesley Road, Aldershot,
> Hampshire,
> GU11 1PZ.
>
>
>
> --------------------------------------------------------------
> --------------------------
>
> This is a PRIVATE message. If you are not the intended
> recipient, please
> delete without copying and kindly advise us by e-mail of the
> mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not
> operate to
> bind CSC to any order or other contract unless pursuant to
> explicit written
> agreement or government initiative expressly permitting the
> use of e-mail
> for such purpose.
> --------------------------------------------------------------
> --------------------------
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]