I would do somthing like the following:
<TABLE border="0"> <c:forEach items="${contacts}" var="contact"> <TR> <TD>${contact.name}</TD> <TD>${contact.number}</TD> <TD><c:url var="url" scope="session" value="/do/modifyContact"> <c:param name="ID" value="${contact.id}"/></c:url> <a href="<c:out value='${url}'/>">Modify</a> </c:forEach> The action modifyContact should load the contact with the specified id, "ID" is available by String ID = request.getParameter("ID"); The action then stores the contact in the request scope: request.setAttribute("contact",contact); then forward to the jsp: name:${contact.name} etc... Hope that helps, Daniel. > -----Original Message----- > From: andy wix [mailto:[EMAIL PROTECTED] > Sent: 31 August 2004 17:19 > To: [EMAIL PROTECTED] > Subject: Re: Identifying the 'clicked' line when iterating over > collection > > > Hi, > > I have tried most of the code in the replies and, alas, fear my > brain is too > small to get any working. > I am persevering with Rick Reumann's method (because I liked the > Struttin' > with Struts stuff!) but I don't get a session parameter in my next page > after the link is followed (I have changed the scope to session). To get > the ID would be something, but it would save me needing an action > class at > all if I could get the contact object representing the 'clicked' row into > the session or request scope. > A cut down version of the code is: > > <form name="form0" method="post"> > <TABLE border="0"> > <% > ArrayList list = (ArrayList)session.getAttribute("Contacts"); > Iterator it = list.iterator(); > int id = 0; > while(it.hasNext()) { > Contact tempContact = (Contact)it.next(); > }%> > <TR> > <TD><%=tempContact.getName()%></TD> > <TD><%=tempContact.getNumber()%></TD> > > <TD><c:url var="url" scope="session" value="/do/modifyContact"> > <c:param name="ID" > value="${form0.tempContact.id}"/></c:url> > <a href="<c:out value='${url}'/>">Modify</a> > > Note that I am not using any Struts Forms for this Action as I > receive the > ArrayList from the session. I added an html form tag as above > because you > had one in the example code. > > Cheers, > Andy > > _________________________________________________________________ > Express yourself with cool new emoticons > http://www.msn.co.uk/specials/myemo > > > --------------------------------------------------------------------- > 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]