You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dean A. Hoover" <dh...@rochester.rr.com> on 2004/08/17 19:33:24 UTC

passing fmt:message as argument

Sorry if this is more JSPish than strutsish,
but I'm sure someone can help. I have
a javascript I am using for tooltips
and I want to pass text defined in
my applications.resource file to it.

== applications.resource ===
someText=This is some text.

== foo.jsp ===

<img src="images/foo.gif" width="10" height="10" alt="[foo]" 
onmouseover="ddrivetip('This is some text.');" 
onmouseout="hideddrivetip();"/>

What do I need to do to the img tag to use the message in 
applications.resource?

Thanks.
Dean Hoover


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


Re: passing fmt:message as argument

Posted by Bill Siggelkow <bi...@bellsouth.net>.
Use the following -- it will work:

<img src="images/foo.gif" width="10" height="10"
alt="[foo]" onmouseover="ddrivetip('<bean:message key="someText"/>');" 
onmouseout="hideddrivetip();"/>

As far as quotes, you just need to make sure that they don't interleave 
-- JSP translation occurs first so you things will work correctly. As 
far as using fmt:message -- either one works okay -- if you do want to 
use the JSTL tags make sure that you define the localization context in 
your web.xml to point to your message resources ...

<web-app>
   <context-param>
     <param-name>
       javax.servlet.jsp.jstl.fmt.localizationContext
     </param-name>
     <param-value>
        ApplicationResources
     </param-value>
   </context-param>
...

Bill Siggelkow


Dean A. Hoover wrote:

> Don't know... didn't happen to see any examples like that.
> Not sure about how the parsing deals with strange nesting of
> angle brackets, quotes, etc.
> 
> Also, aren't we moving away from bean:message in favor
> of fmt:message?
> 


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


Re: passing fmt:message as argument

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
Don't know... didn't happen to see any examples like that.
Not sure about how the parsing deals with strange nesting of
angle brackets, quotes, etc.

Also, aren't we moving away from bean:message in favor
of fmt:message?

Erik Weber wrote:

> Can't you insert a <bean:write message="myKey"/> there?
>
> Dean A. Hoover wrote:
>
>> Sorry if this is more JSPish than strutsish,
>> but I'm sure someone can help. I have
>> a javascript I am using for tooltips
>> and I want to pass text defined in
>> my applications.resource file to it.
>>
>> == applications.resource ===
>> someText=This is some text.
>>
>> == foo.jsp ===
>>
>> <img src="images/foo.gif" width="10" height="10" alt="[foo]" 
>> onmouseover="ddrivetip('This is some text.');" 
>> onmouseout="hideddrivetip();"/>
>>
>> What do I need to do to the img tag to use the message in 
>> applications.resource?
>>
>> Thanks.
>> Dean Hoover
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



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


Re: passing fmt:message as argument

Posted by Erik Weber <er...@mindspring.com>.
Can't you insert a <bean:write message="myKey"/> there?

Dean A. Hoover wrote:

> Sorry if this is more JSPish than strutsish,
> but I'm sure someone can help. I have
> a javascript I am using for tooltips
> and I want to pass text defined in
> my applications.resource file to it.
>
> == applications.resource ===
> someText=This is some text.
>
> == foo.jsp ===
>
> <img src="images/foo.gif" width="10" height="10" alt="[foo]" 
> onmouseover="ddrivetip('This is some text.');" 
> onmouseout="hideddrivetip();"/>
>
> What do I need to do to the img tag to use the message in 
> applications.resource?
>
> Thanks.
> Dean Hoover
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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