OGNL Basics

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0


With expression like [0] ... [3] etc. WebWork Struts 2 will cut the stack and still returned return back a CompoundRoot object. To get the top of that particular stack cut, use 0.top


OGNL supports accessing static properties as well as static methods. As the OGNL docs point out, you can explicitly call statics by doing the following

By default, Struts 2 is configured to disallow this--to enable OGNL's static member support you must set the struts.ognl.allowStaticMethodAccess constant to true via any of the Constant Configuration methods.

OGNL's static access looks like this:

Code Block