struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stéphane Zuckerman <stephane.zucker...@gmail.com>
Subject Re: Pass parameter to javascript function
Date Thu, 09 Jun 2005 12:42:37 GMT
kjersti.berg@adg.no a écrit :
> Really?  IDon't you have to enclose the entire value in one scriptlet
> expression? Like this:
> <logic: iterate .......  indexId="idx" >
>  <html:text property="x" name="y" onclick='<%="lfnSomething(" + idx + ", "
> + idx2 + ")%>'
> />
> 
> 
> You can pass the parameters to the javascript as shown underneath by
> enclosing the <%=%>  in single quotes...
> 
> <logic: iterate .......  indexId="idx" >
>  <html:text property="x" name="y" onclick="lfnSomething('<%=idx%>','
> <%=idx2%>')"
> />
> 

You can even use the ${} notation if you are using JSP 2.4 (IIRC), like 
this :

<logic:iterate ... indexId="idx">
   <html:text property="x" name="y"
              onclick="lfnSomething('${idx}', '${idx2}')"/>

-- 
Stéphane Zuckerman

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message