<j:set var="var" value="servername.${env}" />
<ant:filter token="servername" value="${var}" />
or
<ant:filter token="servername"
value="${context.getVariable('servername.' + env)}" />
I'm not 100% certain the latter works.
- Brett
On Fri, 29 Oct 2004 14:17:46 -0400, Eric Giguere
<[EMAIL PROTECTED]> wrote:
> Ah, I see
>
> I'm not sure if this is feasible...
> One thing sure, you cannot put an expression in an expression (
> ${...${}}. It just does not work with jelly.
> I've done a couple of tests with dynamic property names without success.
>
> Eric.
>
>
>
>
> Ben Anderson wrote:
>
> >yes, that's a solution for the example I gave, but not what I'm looking for.
> >Let me give the real example:
> >
> >config.properties
> >-----------------
> >servername.qa=qaServer
> >servername.prod=prodServer
> >
> >maven.xml
> >---------
> ><u:properties var="props" file="config.properties"/>
> ><j:forEach var="prop" items="${props}">
> > <ant:copy file="${basedir}/WEB-INF/web.xml"
> > tofile="${build.dir}/WEB-INF/web.xml"
> > overwrite="true">
> > <ant:filterset>
> > <ant:filter token="servername" value="${servername.${env}}"/>
> >
> >
> >actually, this is probably a bit much. Is there a way to solve the original
> >example w/out modifying the <j:set> tags?
> >
> >Thanks,
> >Ben
> >
> >Quoting Eric Giguere <[EMAIL PROTECTED]>:
> >
> >
> >
> >>Hello Ben
> >>Yep, try this:
> >>
> >> <j:set var="color" value="red"/>
> >> <j:set var="colorKey" value="${color}"/>
> >> <ant:echo>
> >> ${colorKey}
> >> </ant:echo>
> >>
> >>
> >>Hope it helps
> >>Eric.
> >>
> >>Ben Anderson wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>I want to dynamically set which property I access. Is this possible?
> >>>Obviously the below code won't work, but you get the idea. I thought
> >>>maybe that the <j:expr> tag might help, but it doesn't seem to do
> >>>anything.
> >>>
> >>> <j:set var="color" value="red"/>
> >>> <j:set var="colorKey" value="color"/>
> >>> <ant:echo>
> >>> ${${colorKey}}
> >>> </ant:echo>
> >>>
> >>>Any ideas?
> >>>
> >>>Thanks,
> >>>Ben
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]