velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From angelcervera <an...@acervera.com>
Subject RE: How to keep '$' Char in .vm files?
Date Tue, 28 Aug 2007 21:49:31 GMT


Marco Schoolenberg wrote:
> 
> I seem to remember that escaping the character is the Normal thing to
> do...
> 

In "User Guide" said:

Velocity User Guide wrote:
> 
> VTL directives can be escaped with the backslash character ("\") in a
> manner similar to valid VTL references.
> 

But using this template:


> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD
> Commons Validator Rules Configuration 1.1.3//EN"
> "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
> <form-validation>
> <arg2 key="\${var:maxlength}" name="maxlength" resource="false" />
> </form-validation>
> 

Return this error:


> org.apache.velocity.exception.ParseErrorException: Encountered
> ":maxlength}\" name=\"maxlength\" resource=\"false\"
> />\n</form-validation>\n" at line 4, column 18.
> Was expecting one of:
>     "}" ...
>     <DOT> ...
>     
>         at org.apache.velocity.Template.process(Template.java:141)
> 

Using this template all go ok (special attention in removed character $):


> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD
> Commons Validator Rules Configuration 1.1.3//EN"
> "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
> <form-validation>
> <arg2 key="{var:maxlength}" name="maxlength" resource="false" />
> </form-validation>
> 

So, in conclusion, "$" it's not escaped with "\" character.

I'm using velocity 1.4

Same suggestions? Any help?

Thank's
-- 
View this message in context: http://www.nabble.com/How-to-keep-%27%24%27-Char-in-.vm-files--tf4038353.html#a12376953
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message