I am looking at various libraries that can be used as a templating engine in my project and right now Apache Velocity looks like a good candidate. I have the following doubts regarding its usage:
Is it possible to specify a SQL database query in a template and use the querys' return value to fill a parameter?. I found the following example in the Velocity user guide:
Hello,
#set( $result = $query.criteria("name") )
Your username is $result.
However the guide does not explain much about executing SQL queries. Is it possible to define a SQL SELECT query which returns a value and assign this value to a variable in the template? I am wondering if something like the example below is possible?
Hello,
#set( $result = $executeQuery("SELECT name FROM user") )
Your username is $result.
Would be grateful if you could shed some light on this. Anyone kind enough to provide an example, or point me to a location where I can find additional documentation on this?