You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by piloupy GOTTAPIL <b7...@yopmail.com> on 2007/04/23 15:00:11 UTC

Use EL to access to a key from the MessageResources.properties

Hi,

I'd like to do something like this in a JSP file :

<html-el:link href="${contact.mail}">Email Link</html-el:link>

where contact.mail is a key from my MessageResources.properties.

I think the solution is quite simple, but I can't find how to do.

Thanks in advance,

piloupy

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


Re: Use EL to access to a key from the MessageResources.properties

Posted by piloupy GOTTAPIL <b7...@yopmail.com>.
Thank you all. The solution of Niall works. I was trying to get the
fmt taglib work for nearly 2 days... without success.

But I really prefer the solution of Niall, since it doesn't oblige me
to declare another taglib.

I really thank you guys for your help.

piloupy

On 4/24/07, Niall Pemberton <ni...@gmail.com> wrote:
> How about..
>
> <bean:define id="foo"><bean:message key="contact.mail"/></bean:define>
> <html-el:link href="${foo}">Email Link</html-el:link>
>
> Niall

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


Re: Use EL to access to a key from the MessageResources.properties

Posted by Niall Pemberton <ni...@gmail.com>.
On 4/23/07, piloupy GOTTAPIL <b7...@yopmail.com> wrote:
> Hi,
>
> I'd like to do something like this in a JSP file :
>
> <html-el:link href="${contact.mail}">Email Link</html-el:link>
>
> where contact.mail is a key from my MessageResources.properties.
>
> I think the solution is quite simple, but I can't find how to do.

How about..

<bean:define id="foo"><bean:message key="contact.mail"/></bean:define>
<html-el:link href="${foo}">Email Link</html-el:link>

Niall

> Thanks in advance,
>
> piloupy

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


RE: Use EL to access to a key from the MessageResources.properties

Posted by Rod Bollinger <te...@portablegenius.com>.
Hi Piloupy,

You can use JSTL to format the link before passing it to the <html:link>
tag:

<fmt:message var="myContactMail" key="${contact.mail}" />
<html:link href="${myContactMail}" ... />

Also, take a look at:
http://struts.apache.org/1.3.8/struts-taglib/tlddoc/html/link.html, you can
actually specify a bundle and access key for the tooltip message directly in
the <html:link> tag.

HTH
-Rod

-----Original Message-----
From: piloupy@gmail.com [mailto:piloupy@gmail.com] On Behalf Of piloupy
GOTTAPIL
Sent: Monday, April 23, 2007 11:29
To: Struts Users Mailing List
Subject: Re: Use EL to access to a key from the MessageResources.properties

I precisely want to use the <html:link> to benefit from the relative
context path.

Thanks,

piloupy

On 4/23/07, Lance <la...@marketpipe.com> wrote:
> <a href="<bean:message key="contact.mail" />">Email Link</a>

---------------------------------------------------------------------
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: Use EL to access to a key from the MessageResources.properties

Posted by piloupy GOTTAPIL <b7...@yopmail.com>.
I precisely want to use the <html:link> to benefit from the relative
context path.

Thanks,

piloupy

On 4/23/07, Lance <la...@marketpipe.com> wrote:
> <a href="<bean:message key="contact.mail" />">Email Link</a>

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


Re: Use EL to access to a key from the MessageResources.properties

Posted by Lance <la...@marketpipe.com>.
<a href="<bean:message key="contact.mail" />">Email Link</a>

piloupy GOTTAPIL wrote:
> Hi,
>
> I'd like to do something like this in a JSP file :
>
> <html-el:link href="${contact.mail}">Email Link</html-el:link>
>
> where contact.mail is a key from my MessageResources.properties.
>
> I think the solution is quite simple, but I can't find how to do.
>
> Thanks in advance,
>
> piloupy
>
> ---------------------------------------------------------------------
> 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