开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜