Logging missing variables in FreeMarker
Does anyone know how to list the variables that are missing from the data model of a FreeMarker template? I am trying to give some nice information to the user, such as:
开发者_如何学JAVA"template defines field "foo" but no data was provided"
The only way to find out which variables are missing would be to evaluate the template, since the template language itself is a programming language.
You could try executing the template from within java, catching exceptions, stubbing out those variables and repeating that process until you have them all.
精彩评论