You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Philipp Leusmann <ph...@post.rwth-aachen.de> on 2003/06/26 15:20:58 UTC
variables not resolved
Hello,
currently I am having a problem concatenating two variables.
it should be in the form $var1_$var2 . But the problem is, that the
underscore seems to cause that $var1 is unresolved.
e.g.:
---code---
#set ($var1 = "foo")
#set ($var2 = 1)
#set ($cat1 = "$var1_$var2")
#set ($cat2 = "$var1/$var2")
$cat1
$cat2
---/code---
---output---
$var1_1
foo/1
---/output---
Why is that? Do I have to escape the underscore somehow?
Would be great if someone could help.
Thanks,
Philipp
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
AW: variables not resolved
Posted by Philipp Leusmann <ph...@post.rwth-aachen.de>.
Ahh, ok. That does work. Thank you.
In the meantime I used
#set ($underscore = '_')
#set ($concat = $var1$underscore$var2)
But that does look quite nasty.
Regards,
Philipp
> -----Ursprungliche Nachricht-----
> Von: Sam Le Berrigaud [mailto:sleberrig@dexem.com]
> Gesendet: Donnerstag, 26. Juni 2003 15:35
> An: Velocity Users List
> Betreff: Re: variables not resolved
>
>
> try ${var1}_$var2
>
> I think it goes well like that.
>
> SaM
>
> Philipp Leusmann wrote:
>
> >Hello,
> >
> >currently I am having a problem concatenating two variables.
> >it should be in the form $var1_$var2 . But the problem is, that the
> >underscore seems to cause that $var1 is unresolved.
> >e.g.:
> >---code---
> >#set ($var1 = "foo")
> >#set ($var2 = 1)
> >#set ($cat1 = "$var1_$var2")
> >#set ($cat2 = "$var1/$var2")
> >$cat1
> >$cat2
> >---/code---
> >
> >---output---
> >$var1_1
> >foo/1
> >---/output---
> >
> >
> >Why is that? Do I have to escape the underscore somehow?
> >
> >Would be great if someone could help.
> >
> >Thanks,
> > Philipp
> >
> >
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: variables not resolved
Posted by Sam Le Berrigaud <sl...@dexem.com>.
try ${var1}_$var2
I think it goes well like that.
SaM
Philipp Leusmann wrote:
>Hello,
>
>currently I am having a problem concatenating two variables.
>it should be in the form $var1_$var2 . But the problem is, that the
>underscore seems to cause that $var1 is unresolved.
>e.g.:
>---code---
>#set ($var1 = "foo")
>#set ($var2 = 1)
>#set ($cat1 = "$var1_$var2")
>#set ($cat2 = "$var1/$var2")
>$cat1
>$cat2
>---/code---
>
>---output---
>$var1_1
>foo/1
>---/output---
>
>
>Why is that? Do I have to escape the underscore somehow?
>
>Would be great if someone could help.
>
>Thanks,
> Philipp
>
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org