velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aegir Sun <Aegir....@Sun.COM>
Subject Re: one question
Date Tue, 21 Mar 2006 02:05:13 GMT
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: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message