This is a very good reason to start using Struts-EL, the contrib tag
library that integrates the expression language of the JSTL with Struts
tags.

Your "bean:write" call in the attribute of the "html:link" tag doesn't
work because you can't embed custom tags in the attributes of custom
tags.

If you move to using Struts-EL (and the JSTL), your original code would
now look like this (and should work):

        <html:link href='' onclick='closeWindowWithCode(${signal.code})'
>
                <c:out value="${signal.code}"/>
        </html:link>

> -----Original Message-----
> From: Frederic Dernbach [mailto:[EMAIL PROTECTED] 
> 
> 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]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to