You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by haim <ha...@012.net.il> on 2005/03/10 15:14:05 UTC

Placing message beans inside other tages

HI.

Please forgive me if this is a stupid question , I failed to find an 
answer for this issue.

How do I place a message into an attribute of a taglib.
For example lets assume that I want to place the src of an image from a 
recourse bundle. Using the <html:img /> tag.

I thought that this should work

<html:img src='<bean:message key=”my.image”/>'/>

But i get the <bean:message key=”my.image”/> as string and not as a the 
message itself.

Any Suggestions?

Thanks

Haim



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


Re: Placing message beans inside other tages

Posted by Rick Reumann <st...@reumann.net>.
Bob Arnott wrote the following on 3/10/2005 10:04 AM:

> Use the srcKey attribute on the <html:img /> tag to specify the property 
> in your resource bundle that you want to use:
> 
> http://struts.apache.org/userGuide/struts-html.html#img
> 
> <html:img srcKey="my.image" />

Darn it Bob:) You made me look at the html:img tag again, and now I 
realize it's cleaner than what I'm doing with JSTL. I love that the 
html:img tag has a titleKey. Now I have to be anal and go change all the 
places in my code to use html:img. Unless someone knows of a nice JSTL 
equivalent? I had removed most of my struts specific tags but I think I 
want to put this one back. Good stuff.

-- 
Rick

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


RE: Placing message beans inside other tages

Posted by Bob Arnott <bo...@aungate.com>.
haim wrote:
> HI.
> 
> Please forgive me if this is a stupid question , I failed
> to find an answer for this issue.
> 
> How do I place a message into an attribute of a taglib.
> For example lets assume that I want to place the src of
> an image from a recourse bundle. Using the <html:img />
> tag. 
> 
> I thought that this should work
> 
> <html:img src='<bean:message key="my.image"/>'/>
> 
> But i get the <bean:message key="my.image"/> as string
> and not as a the message itself.

Use the srcKey attribute on the <html:img /> tag to specify the property 
in your resource bundle that you want to use:

http://struts.apache.org/userGuide/struts-html.html#img

<html:img srcKey="my.image" />

Cheers,

-- 
Bob Arnott



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