Lori,
notice I took this to the struts list. The struts tags don't support
runtime expressions. There is a subset of struts tags that supports
EL (expression language). You might try the following approach:
<c_rt:set var="pathParam" value="<%= pathParm %>"/>
<html-el:img ... onclick="${pathParam}"/>
However, it'd be even better if you didn't need the first line. There
are times when scriplet expressions must be used (static variables),
but you should try to avoid them when you can.
-Ben
On Wed, 10 Nov 2004 11:10:48 -0800, Cook, Lori A <[EMAIL PROTECTED]> wrote:
> I am experiencing difficulty using tag libraries and the passing through
> of scripting variables in attributes. Specifically I'm trying to add an
> onclick value to an <html:img> tag but this is generic for any tag in
> the Struts libraries where the user can supply a value to an attribute.
>
> When the following markup is used in a jsp:
> <img src="minor.gif" alt="" onclick="confirmAction(<%= pathParam
> %>);" />
> <img src="minor.gif" alt="" onclick=<%= "\"confirmAction(" +
> pathParam + ");\"" %> />
> The resulting HTML is:
> <img src="minor.gif" alt="" onclick="confirmAction(Foo);" />
> <img src="minor.gif" alt="" onclick="confirmAction(Foo);" />
>
> As you can see either one of the jsp versions 'work' to create a good
> onclick method.
>
> But when the code is changed to use the <html:img> tag it doesn't work.
> That is with the following jsp markup:
> <html:img src="normal.gif" alt="" onclick="confirmAction(<%=
> pathParam %>);" />
> <html:img src="normal.gif" alt="" onclick=<%= "\"confirmAction(" +
> pathParam + ");\"" %> />
> The resulting HTML is:
> <img src="normal.gif" alt="" onclick="confirmAction(<%= pathParam
> %>);">
> <html:img src="normal.gif" alt="" onclick="confirmAction(Foo);" />
>
> While the first instance of <html:img> gets changed into the <img>
> markup the scripting variable pathParam does not get resolved. In the
> second case the scripting variable gets resolved but the <html:img> does
> not get changed into its appropriate <img>.
>
> Why? And how do you get the correct behavior?
>
> Any help is greatly appreciated.
> Lori Cook
>
> ---------------------------------------------------------------------
> 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]