Thanks a lot, Craig for encouraging me to join this group.

I'll take a look at this approach using another bean that has access to my locale-specific properties file.

Rose Joshua

-----Original Message-----
From: Craig.Tataryn /Internet/dd.RFC-822=Craig.Tataryn@msdw.com
[mailto:Craig.Tataryn@msdw.com]
Sent: Friday, February 16, 2001 9:43 AM
To: struts-user /Internet/dd.RFC-822=struts-user@jakarta.apache.org
Cc: Craig.Tataryn /Internet/dd.RFC-822=Craig.Tataryn@msdw.com
Subject: FW: Re: Variable substitution in template tags

Hey Rose, glad to see you joined the list!  There was just a posting
yesterday that addressed a similar problem where a person wanted to add a
Resource message as the value the "alt" attribute of the html:img but could
nest the <bean:message/> tag.

The answer I gave is below, try it out and see if it works:

==============================================
How about this:

<!-- MyResources would be replaced with whatever class name you used in the
application init-param you setup for the ActionServlet
-->
<jsp:useBean id="resouces" class="MyResources" />

<html:img src="someImage.png" alt='<%=
resources.getString("someImage.alt.text")
%>'/>

Craig T.

Peter Alfors wrote:

> scratch that.  You would need to have a bean that had access to the
messages.
>
> Peter Alfors wrote:
>
> > I think that <bean:define>  does what you want.
> >
> > <bean:define id="altTxt" property="someImage.alt.text"/>
> > <html:img src="someImage.png" alt="<%= altTxt %>"/>
> >
> > HTH,
> >     Pete
> >
> > Howard Moore wrote:
> >
> > > Can anybody suggest how I can add internationalised alt text to the
> > > <html:img> tag?
> > >
> > > If it were legal I would like to do something like the following;
> > >
> > > <html:img src="someImage.png" alt="<bean:message
> > > key='someImage.alt.text'/>"/>
> > >
> > > but you can't nest tags like this.
> > >
> > > If not does anybody think it would be useful to add an optional 'id'
> > > attribute to the <bean:message> tag which, if set, causes the
translated
> > > message to be stored in a page context bean with the given name rather
than
> > > being written out? This would allow me to write something like;
> > >
> > > <bean:message id="altTxt" key="someImage.alt.text"/>
> > > <html:img src="someImage.png" alt="<%= altTxt %>"/>
> > >
> > > It would also allow translated strings to be cached in the page if
they are
> > > going to be used repeatedly (inside a <logic:iterate> tag, for
example).
> > > This may improve performance considerably.
> > >
> > > Any comments?
> > >
> > > -------------------------------------------
> > > Howard Moore
> > > Senior Software Engineer
> > > Datapulse CTI
> > > Tel : +44 (0)1491 418000
> > > Fax : +44 (0)1491 411459
> > > E-mail: Howard.Moore@datapulse.com

--
I've been trying to change the world for years, but they just won't give me
the
source code....

Rose.Joshua@shell.ca wrote:

> Hello Everyone,
>
> I am a brand new user; only subscribed about 15 minutes ago.
>
> My team is doing some preliminary investigations into the use of struts
> for rendering jsp-based browser pages.  I took a close look at the
> struts-template sample application, and we are okay with setting our
> template header and sections using put and get statements.  However, we
> have added an extra dimension to it in which we actually pick up
> different template headers depending on our user's locale, and then we
> define specific template file names in resource bundle properties files.
>
> Based on our structure, we need to do a VARIABLE (or properties key)
> SUBSTITUTION, as follows:
>
> <template:insert template='<bean:message key="templateName.JSP"/>' />
>
> Or variable substitution as follows:
> <template:insert template='<%= somePreviouslyDefinedVariableName %>' />
>
> We do the same for puts and gets, etc, thereby nesting bean tags in
> template tags.  We have of course include the struts-bean.tld file in
> our taglib declarations, as well as defined our Resource Application
> parameter in web.xml. Tomcat squeaks when we perform this variable
> substitution or nested tags.
>
> Is this allowed?  Can anyone please give us directions, recommendations
> as to how to go about substitution in struts tags generally?
>
> Thanks a lot!
>
> Rose Joshua
> Information and Computing / eBusiness Unit
> Shell Canada Limited
> Calgary, Alberta.
> Telephone:  (403)-691-4527
> email: <rose.joshua@shell.ca>

--
I've been trying to change the world for years, but they just won't give me
the source code....