Thanks. That does the trick.

-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: 02 November 2005 17:36
To: Velocity Users List
Subject: Re: Escaping VTL References

Backslash can't be relied on.

Use

#set($d = '$')
${d}{madeup}

You can also use ${esc.d} instead of ${d} if you have the escape tool
in your template.


On 11/2/05, Adam Flynn <[EMAIL PROTECTED]> wrote:
> OK. Let's say I want to output ${madeup} as a literal in my template.
> All I need to do is prefix a backslash and I'm done right? Maybe not.
> Consider the following.
>
> Let's say appId is in the velocity context and is equal to i00010. Let's
> also say madeup isn't in the velocity context. The following template
> snippet...
>
> ${appId}
> \${appId}
> ${madeup}
> \${madeup}
>
> ...will produce the following output...
>
> i00010
> ${appId}
> ${madeup}
> \${madeup}
>
> But this is wrong, surely? What happens if I use a context that *does*
> contain madeup. I just want to output the literal ${madeup} (for example,
> because I am producing a JSTL page, or another velocity file): the
contents
> of the context should be irrelevant.
>
> Am I missing something here? The alternative is that I use some sort of
> naming convention to avoid this situation.
>
> Thanks in advance,
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to