Read Velocity Tokens/Tag from .vm file
Posted
by
user1801660
on Stack Overflow
See other posts from Stack Overflow
or by user1801660
Published on 2012-11-06T00:47:19Z
Indexed on
2012/11/06
23:01 UTC
Read the original article
Hit count: 186
velocity
I have an application where in I am trying to create a velocity template repository which will help me centralise all my email templates and will allow me to create a communication hub. All templates will be called at runtime and populates with data via services.
My problem is that I need to provide users with optional and compulsory params list when they define the template inputs for the velocity template.
Is there a way to read the tokens/tags from the velocity template file and extract them??
Like I want a list of tokens $name.address.streetName to be available to me from .vm file.
I do not want to go for Regex .
I do not have to cache or reuse them , its just going to be a one time read and store the default,compulsory & optional params in the database.
I am following these patterns : http://kickjava.com/src/org/apache/velocity/test/view/TemplateNodeView.java.htm
How to use String as Velocity Template?
Please advice.
© Stack Overflow or respective owner