cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist>
Subject Re: <jx:set/> is not working as excpected
Date Wed, 31 Aug 2005 16:07:31 GMT

On Aug 31, 2005, at 8:36 AM, Stephan Coboos wrote:

> Hello,
> I assume
> <jx:set var="world" value="WORLD"/>
> <jx:set var="helloWorld" value="HELLO ${world}"/>
> ${helloWorld}
> should output the string "HELLO WORLD". Is this correctly? But it 
> doesn't
> work in Cocoon 2.1.6. What I got is "HELLO ${world}". This means the 
> var
> ${world} in the set of helloWorld wasn't interpreted. What's wrong 
> here?

You're right, <jx:set> doesn't do string interpolation.  I remember 
looking at the source code a couple of weeks ago when I was puzzling 
over this very thing.  IIRC,  the value attribute needs to contain 
either (a) a literal string, or (b) a valid JExL expression enclosed in 
'${}' (and JExL seemingly doesn't have a string concatenation 
function).  "HELLO ${world}" doesn't start with "${", so JXTG parses it 
as a literal string.

> PS: If I'm doing <jx:set var="helloWorld" value="${world}"/> the var
> ${world} gets interpreted! Why?!?

See above, it should now be clear :-/

The bad thing is, studying the user doc for JXTG would lead one to 
believe that string interpolation is supported by <jx:set>, because I 
think we show it in a code example!


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message