try this:
<bean:define id="signal" property="code"/>
<html:link
href=''
onclick='<%="closeWindowWithCode("+signal+")"%>' >
Frederic Dernbach <[EMAIL PROTECTED]>
10/16/03 09:57 AM
Please respond to "Struts Users Mailing List"
To: struts-user <[EMAIL PROTECTED]>
cc:
Subject: Calling a javascript function with the <logic:iterate> tag
How can I call a javascript function with one parameter using a
<logic:iterate> tag (the parameter being different from row to row).
Below is a simple JSP snipplet which uses an iteration. Its first
item prints a "code" property with an hyperlink with a "onclick"
attribute that points to a javascript function with ONE parameter
(closeWindowWithOK).
As you can see, I would like to pass the "code" property to the
javascript function when the link is clicked on.
How can I do this ? How should I write the "onclick" attribute of the
<html:link> tag ? Obviously waht I write is wrong since I do not get the
expected result.
Thanks in advance for your help.
Fred
<script type="text/javascript">
function closeWindowWithCode(myparameter)
{
opener.updateWith(myparameter);
window.close();
}
</script>
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr align="left">
<th>Code</th>
</tr>
<logic:iterate name="searchSignalForm"
property="signals"
id="signal"
type="com.rubis.web.system.bean.SignalBean">
<tr align="left">
<td>
<html:link
href=''
onclick='closeWindowWithCode(<bean:write
name="signal"
property="code"/>)' >
<bean:write name="signal"
property="code"/>
</html:link>
</td>
</tr>
</logic:iterate>
</table>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
= = = = = = = = = == = = = = = == = = = = = = = == = = = = = == = = = =
This transmittal and any attachments may contain confidential, privileged or sensitive
information and is solely for the use of the intended recipient. If you are not
intended recipient, you are hereby notified that you have received this transmittal
and any such attachments in error and any review, dissemination, distribution or
copying thereof is strictly prohibited. If you have received this transmittal and any
attachments in error please notify the sender and immediately destroy the message and
all its attachments. Any opinions herein expressed may be those of the author and not
necessarily of Mizuho Corporate Bank, Ltd (the "Bank"). The Bank accepts no
responsibility for the accuracy or completeness of any information herein contained.
= = = = = = = = = == = = = = = == = = = = = = = == = = = = = == = = = =