Subject: Re: apply a prefix to bean:message's "key" (or "name" + "property") attribute? From: "Jeff" <[EMAIL PROTECTED]> === Hmm... that definitely works. I'm going to have to beg for Sun's forgiveness, though...
("forgive me, Sun, for I have sinned... my last use of a scriptlet in a model 2 MVC web application was 3 months ago...") I guess it's time to file an enhancement request to ask for the addition of a "prefix" attribute to the bean:message tag. Thanks for the suggestion, though! It DOES work, so at least I can sleep tonight and worry about linguistic purity later :-) "Joachim Gjesdal" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED].; > how about, > > <%countyCode="country."+countryCode%> > <bean:message name="<%=countryCode%>"/> > > joachim > > Struts Newsgroup (@Basebeans.com) wrote: > > >Subject: apply a prefix to bean:message's "key" (or "name" + "property") attribute? > >From: "Jeff" <[EMAIL PROTECTED]> > > === > >Is it possible to specify some prefix that should be prepended to the > >message key name specified by either the "key" attribute or derived from the > >"name" + "property" attributes of the bean:message tag? > > > >Example: > > > >in ApplicationResources.properties, I have country names defined as follows: > > > >country.uk=United Kingdom > >country.se=Sweden > >country.us=United States > >etc. > > > >In my jsp page, I'm using a nested:iterate tag to loop through an array of > >Strings representing the 2-character ISO code for several countries. Ex: > > > >country[0]="ar"; > >country[1]="uk"; > >country[2]="us"; > >etc. > > > >I'm having no problem with accessing the array's values within the iteration > >block, but I've hit the wall insofar as being able to use them to obtain the > >country names from the properties file, because I need to find a way of > >prepending the prefix "country." to the property key. > > > >The following works: > > > ><nested:iterate id="countryCode" property="../../countryCode"> > ><%=countryCode%><BR> > ></nested:iterate> works fine: > > > >ar > >uk > >us > > > >The problem I'm having is finding a way to do the legal equivalent of: > > > ><bean:message name="country.<%=countryCode%>"/> > > > >which would work fine -- if it weren't prohibited by Sun :-( > > > >ideally, something along the lines of: > > > ><bean:message prefix="country" name="countryCode"/> > > > >Any suggestions? > > > > > > > >-- > >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>