<p>Is it possible to access a constant value (i.e. a public static final variable defined in a Java class) from a Velocity template?</p>

<p>I would like to be able to write something like this:</p>

<pre><code>#if ($a lt Long.MAX_VALUE)
</code></pre>

<p>but this is apparently not the right syntax.</p>

Velocity can only use anything it finds in its context, after e.g.
```
```
context.put("MaxLong", Long.MAX_VALUE);
```
```
You cannot use statics, or access static members of things in Velocity's context due to the way its lookup works (see Velocity's
Property lookup rules
). The best thing to do is add the value you want to check against explicitly in your context.
Edit October 6
on second sight, it seems to be possible to access static members. See the velocity
Developer guide - Support for "Static Classes"
for more information. I have not tried this out, though.