2

How can I call a static method from a (velocity) template when using Apache Click?

Kdeveloper
  • 13,679
  • 11
  • 41
  • 49
myahya
  • 3,079
  • 7
  • 38
  • 51
  • See also [Calling class methods (static) from inside a velocity view page](http://stackoverflow.com/questions/2329191/calling-class-methods-static-from-inside-a-velocity-view-page). – Vadzim Apr 25 '17 at 13:31

2 Answers2

3

You can use

addModel("MyClass", MyClass.class)

in your Page.

jhoff
  • 100
  • 1
  • 10
2

Velocity 1.6 and up supports this:

http://velocity.apache.org/engine/devel/developer-guide.html#supportforstaticclasses

Bob Schellink
  • 144
  • 1
  • 4