Hi,

I tried your example in my working environment. And in the web server's
output log,
I got the following error message:

2006-3-21 9:59:33 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn]
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = /index.vm [line 8,column 1] : $\!foo is not a valid reference.
2006-3-21 9:59:33 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn]
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = /index.vm [line 9,column 1] : $\!{foo} is not a valid reference.
2006-3-21 9:59:33 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn]
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = /index.vm [line 10,column 1] : $\\!foo is not a valid reference.
2006-3-21 9:59:33 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn]
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = /index.vm [line 11,column 1] : $\\\!foo is not a valid reference.

So I guess velocity engine regards the usage as an invalid usage.

Regards



吴耀华 写道:

>Advanced Issues: Escaping and !
>When a reference is silenced with the ! character and the ! character preceded 
>by an \ escape character, the reference is handled in a special way. Note the 
>differences between regular escaping, and the special case where \ precedes ! 
>follows it: 
>
>#set( $foo = "bar" ) 
>$\!foo 
>$\!{foo} 
>$\\!foo 
>$\\\!foo 
>This renders as: 
>
>$!foo 
>$!{foo} 
>$\!foo 
>$\\!foo 
>
>So that I can assume if i get a clause like:
>$\\\\\!foo
>that will render as:
>$\\\\!foo
>is it right? just lose one backslash?
>
>
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to