It will be easier if you can tolerate with an hyperlink instead of a button:
<table>
<logic:iterate id="element" type="myPackage.elementClass"
name="myVectorOfElementInstances">
<tr>
<td><bean:write name="element" property="elementKey" filter="true" /></td>
<td><bean:write name="element" property="firstName" filter="true" /></td>
<td><bean:write name="element" property="lastName" filter="true" /></td>
<td>
<html:link page="/viewElementDetailAction.do" paramId="no"
paramName="element" paramProperty="elementKey">
Click to see details
</html:link>
</td>
</tr>
</logic:iterate>
</table>
And in your ViewElementDetailAction, you retrieve the key by
request.getParameter("no");
If you really need a button, this may work but ugly:
<form action="/viewElementDetailAction.do">
<table>
<logic:iterate id="element" type="myPackage.elementClass"
name="myVectorOfElementInstances">
<tr>
<td><bean:write name="element" property="elementKey" filter="true" /></td>
<td><bean:write name="element" property="firstName" filter="true" /></td>
<td><bean:write name="element" property="lastName" filter="true" /></td>
<td>
<submit name="no"
value='<bean:write name="element" property="elementKey"/>'>
</td>
</tr>
</logic:iterate>
</table>
</form>
regards,
--
John
At 11:33 pm 23-10-2001 -0400, you wrote:
Hi,
I have a JSP page which display a list of elements from a Vector in a HTML table.
I want to put a button in each line of my table that let me view the element's detail (throught my elementForm)
I don't know how I can pass a specific element to my viewElementDetailAction which use an elementForm
I tried to use a standard form tag like this, but it doesn't works
Is this the correct approach?
Thanks for any suggestions,
Nicolas
<table>
<logic:iterate id="element" type="myPackage.elementClass" name="myVectorOfElementInstances">
<tr>
<td><bean:write name="element" property="elementKey" filter="true" /></td>
<td><bean:write name="element" property="firstName" filter="true" /></td>
<td><bean:write name="element" property="lastName" filter="true" /></td>
<td>
<form method="post" action="/viewElementDetailAction" name="elementForm" type="myPackage.elementForm">
<input type="hidden" name="no" value="<bean:write name="element" property="elementKey" filter="true" />">
<input type="submit" name="btnView" value="View"/>
</form>
</td>
</tr>
</logic:iterate>
John Yu Scioworks Technologies
e: [EMAIL PROTECTED] w: +(65) 873 5989
w: http://www.scioworks.com m: +(65) 9782 9610
Scioworks Camino - "Rapid WebApp Assembly for Struts"