velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apa...@recks.org
Subject Re: checking if all variables are present
Date Tue, 28 Jul 2009 10:47:09 GMT
several possibilities:

a) You can use the experimental TemplateTool to programmatically get a list of references
to check against the context before rendering:
  http://svn.apache.org/repos/asf/velocity/engine/trunk/experimental/templatetool/TemplateTool.java

b) Use an buffering writer and a ReferenceInsertionEventHandler to stop rendering if something
is missing

c) Check with #if($!myvar != null) before using reference content (as in previous answer to
this thread).

Hope this helps somehow,
Christoph

Captain Cid wrote:
> I have a template containing some variables to be rendered from context.
> Is there way by which i can know if all the variables are present in the
> context, otherwise throw an error.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message