I'd like to access all properties of a certain model class within the template. If I do
VelocityContext context = new VelocityContext();
context.put("model", new MyModel());
and MyModel
is like
public class MyModel {
private String propertyA;
private String propertyB;
public String getPropertyA() { return propertyA; }
public String getPropertyB() { return propertyB; }
}
then I need to specify the model's alias with every access of it's properties.
This is my template with properties like $model.propertyA and $model.propertyB.
What I would like to achieve is that the template variables doesn't need to specify model.
as prefix for a certain context member, like so:
This is my template with properties like $propertyA and $propertyB.
Every variable should be treated like a property of the given "root" object of type MyModel
. Is this possible and if yes, how?