Using Velocity Toolsin Velocity templates

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

Using Velocity Toolsin Velocity templates

#1

Postby dvanhussel » Wed Mar 11, 2015 12:37 pm

Hi,

I would like to use the html escape functionality of the Velocity Tools (http://velocity.apache.org/tools/devel/ ... .html#html() )

I have put velocity-tools-2.0.jar in ufs/WEB-INF/lib and the following in /WEB-INF/classes/velociy.properties

Code: Select all

tools.toolbox = application
tools.application.esc=org.apache.velocity.tools.generic.EscapeTool
In the velocity template that is defined in Ebase Designer, I have:

Code: Select all

$esc.html($CONTROL)
This is not rendered as expected, it is output as the literal $esc.html($CONTROL) No errors are loged, it just doesn't work.

Has anyone used Velocity tools in Ebase? And if so, how whas it configured?

Regards,

David
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Thu Mar 12, 2015 11:15 am

David,

I've never used Velocity Tools, but a a couple of comments on this:

If you're trying to use Velocity in a custom layout, any generated HTML should already be escaped if it needs to be. Also, if you're using a custom layout, I don't think velocity.properties is being read.

Having said that, I would expect to see an error saying $esc is undefined and if you're not seeing this, it implies that it's been found.

Regards
Jon
0 x

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

#3

Postby dvanhussel » Tue Mar 17, 2015 7:52 am

Hi Jon,

Thank you for your reply. You are right, I was thinking in the wrong direction for a solution for the problem I was solving.
Indeed, the escaping should already be done when the data is send to Velocity.

I solved this with a function that escapes all data before further processing. So, I don't need the Velocity tools right now.

Regards,

David
0 x


Who is online

Users browsing this forum: No registered users and 25 guests