Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

By default there isn't much you have to do to use the new compilation abilities in OGNL.  Following is an example of compiling a simple property expression and invoking it.

Code Blocknoformat
SimpleObject root = new SimpleObject();OgnlContext context =  (OgnlContext) Ognl.createDefaultContext(null);  Node node =  (Node) Ognl.compileExpression(context, root, "user.name");String userName = node.getAccessor().get(context, root);