Hi,
I have been using Velocity Engine 1.5 to render html pages. It is very
good and robostus engine. I have been building a lots of web pages
width i18n (internationalization and localization) and Velocity engine
help for me to switch in run time the labels on web page from
database. It is working very good (I made a good and easy web
developing framework).
Now, I need to write some internationalized java script files. I want
to use Velocity engine for simple assignment in my JavaScript code:
var msgLoading = "$msgLoading";
var msgDone = "$msgDone";
I made a servlet which catch the all http/https *.js request and
replace all velocity tokens with real value from database. It is
working but I have a little and important problem:
My favorite JavaScript prototype is jQuery. This prototype use very
often the $ symbol. I try to use Velocity engine with jQuery but
sometimes it is not working good because there are some character
combination in jQuery source code which begin with $ character. Of
course I do not assign value to these velocity tokens.
For example:
(1)
in JavaScript source code: $Date
on the screen: $Date
result: OK
(2)
in JavaScript source code: $!="W")H D=$;18.$=E;H
on the screen: $="W")H D=$;18.$=E;H
result: ERROR
(3)
in JavaScript source code: (1m $!="W")H D=$;18.$=E;H
u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;E.1b=E.3A={5N:G(c,a){c=c||U;9(1m
c=="1M"){H m=u.2S(c
on the screen: (1m $="W")H D=$;18.$=E;H
u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;E.1b=E.3A={5N:G(c,a){c=c||U;9(1m
c=="1M"){H m=u.2S(c
result: ERROR
(4)
in JavaScript source code: $!
on the screen: $
result: ERROR
(5)
in JavaScript source code: $!!
on the screen: $!
result: ERROR
(6)
in JavaScript source code: $!!!
on the screen: $!!
result: ERROR
(7)
in JavaScript source code: ${!!}
on the screen: ${!!}
result: OK
(8)
in JavaScript source code: $#
on the screen: $#
result: OK
You can see there are some wrong character combination: 2, 3, 4, 5 and
6. The velocity engine modified the original character combinations:
$! -> $ and $!! -> $!.
I think I have to configure the velocity engine that it do not modify
$!... characters.
Please help me to configure my velocity engine.
Thx, SoMa
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]