struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <david.k...@attws.com>
Subject RE: I18N Issues and Best Practices
Date Thu, 12 Dec 2002 23:34:43 GMT
Note that rtexprvalues have to be the ENTIRE attribute value, not just a
portion, so your examples like "header-<%=countryCode%>" can't work like
that.  If you still wanted to use rtexprvalues, you'd have to use
something like '<% "header-" + countryCode %>'.

A cleaner solution is probably to use the JSTL and Struts-EL.
Referencing bean values in the EL is much easier than referencing
rtexprvalues.  For some simple examples in your case:

   <html-el:form action="action-${countryCode}.do">

   <html-el:option value="${x.y}">

   <html-el:img src="img/${regionCode}/picture.gif">

Struts-EL is normally in the Struts nightly build, but the last few days
we've had an unknown problem that is preventing it from going into the
distribution.

> -----Original Message-----
> From: Paul Hodgetts, Agile Logic [mailto:phodgetts@agilelogic.com]
> 
> I've been working on a site that is intended to be fully
> I18N.  It's the first site I've tried where I'm really
> going for a full and clean separation of the layout from
> the content, so please forgive any rookie questions.
> 
> I've looked into getting strings into resource files and
> also the ways that struts and tiles can choose layouts
> based on the country/language as well.  I think I can
> figure these out with a little reading and experimenting.
> 
> One issue that's got me stumped is how to deal with some
> of the finer-grained things on the page.  For example,
> when the path and/or name of a graphic file needs to be
> dynamically constructed, or the page name for a link, or
> the value for a select option.
> 
> I find in these areas that the only solution I can get
> to work is to embed a piece of scriptlet into the struts
> or html tag.  It doesn't seem to be able to parse an
> embedded tag that is stuck in the middle of attribute
> definition of another tag.
> 
> Here's a couple of examples:
> 
> * A div where the class name is built with some dynamic
> data:
>    <div class="header-<%=countryCode%>">
> 
> * A struts html:form tag where the action URL is built
> using dynamic data:
>    <html:form action="action-<%=countryCode%>.do">
> 
> * A select option where the value comes from a bean:
>    <html:option value="<bean:write name="x" property="y"/>">
>    <html:option value="<%=x.getY()%>">
> 
> * An image where the source needs a path dynamically
>    generated:
>      <html:img src="img/<%=regionCode%>/picture.gif>
> 
> Anyway, hopefully that gives you the idea of the types
> of issues I'm having trouble with.
> 
> I'd really appreciate any tips or pointers to references
> on how to get the rest of the scriptlet code out of the
> page, in a way that supports i18n of the content.  I've
> been looking a bit at custom tags, but I don't quite see
> how to use them to solve these issues yet.
> 
> Thanks in advance for any help,
> Paul
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

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


Mime
View raw message