You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Ben Anderson <be...@gmail.com> on 2004/11/11 20:00:22 UTC

Re: , onclick and

alright, I flubbed you up yesterday.  That's what I get for trying to
give advice even though I haven't used the framework much recently. 
But this one I'll get right...
You can't define an xml element as an attribute of another element. 
This is an xml rule - nothing specific to struts or whatever other
taglibs you are using.  Now this is where the el can come in handy:

<c:set var="delete"><bean:message key="delete"/></c:set>
<html-el:img src="normal.gif" border="0" alt=""
onclick="confirm('${delete}');"/>

hth, 
Ben

On Thu, 11 Nov 2004 10:31:22 -0800, Cook, Lori A <lo...@hp.com> wrote:
> Can anyone help with this? I'm using Struts and am having difficulties
> getting the result of a <bean:message> into an 'onclick' of an
> <html:img> tag.
> 
> Here's the markup in the jsp for <img>:
>  <img src="normal.gif" border="0" alt="" onclick="confirm('<bean:message
> key="delete"/>');"/>
> The (correct) result is:
>  <img src="normal.gif" border="0" alt="" onclick="confirm('Delete?');"/>
> 
> When I change to using <html:img> instead of <img> the result is:
>  <html:img src="normal.gif" border="0" alt=""
> onclick="confirm('Delete?');"/>
> 
> As you can see, while the <bean:message> was retrieved and the 'onclick'
> value correctly created. But the <html:img> was not transformed to an
> <img> tag.
> 
> Why not? What am I doing wrong? At some point I'm going to want to
> retrieve a pointer to a localized graphic and alternate title for the
> <html:img> so the use of <bean:message> is not specific to 'onclick'.
> 
> Any help is greatly appreciated.
> 
> Lori Cook
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
>

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