Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added note about static access config.

...

ognl expression

description

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="af57d1f86046b29b-1d3b5902-428b447a-8ae3a996-df2f8ce35f5b8fe6f378ad1b"><ac:plain-text-body><![CDATA[

[0].top

would get the top of the stack cut starting from element 0 in the stack (similar to top in this case)

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a29d90dcd2c6e37f-852d09fd-4b82496c-9d50a825-e38a9bd01ecb7e537759ee48"><ac:plain-text-body><![CDATA[

[1].top

would get the top of the stack cut starting from element 1 in the stack]]></ac:plain-text-body></ac:structured-macro>

...

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
none
none
@some.package.ClassName@FOO_PROPERTY
@some.package.ClassName@someMethod()

...

Old Expression

New Expression

foo/blah

foo.blah

foo/someMethod()

foo.someMethod()

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f81e0d5c4d224f85-a878614c-464e461f-a2879dd3-1664c2a630288130e54705b9"><ac:plain-text-body><![CDATA[

../bar/blah

[1].bar.blah

]]></ac:plain-text-body></ac:structured-macro>

@baz

not directly supported, but #baz is similar

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5d8bc87d7e569eb1-652c0186-440a4784-8d40ad0b-ccfda322a059f19b44da510f"><ac:plain-text-body><![CDATA[

.

top or [0]

]]></ac:plain-text-body></ac:structured-macro>

...

name

value

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="de66be9204a11549-233e0f98-421a4877-a9a2a899-fcb4d7c96a0fa3d6269e8f3f"><ac:plain-text-body><![CDATA[

#parameters['foo'] or #parameters.foo

request parameter ['foo'] (request.getParameter())

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a3139426ff646538-387e7913-44154cd2-93c1b40a-3fe6c387570f7fa19fc1a409"><ac:plain-text-body><![CDATA[

#request['foo'] or #request.foo

request attribute ['foo'] (request.getAttribute())

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="922ee034657690d5-28315d99-4b984e5a-afee96da-2de794710ec0a9a61e316c55"><ac:plain-text-body><![CDATA[

#session['foo'] or #session.foo

session attribute 'foo'

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a3aefa65dfe4c9ea-8fce8cca-468f4b19-9bf0a24d-f3b2555093a1e7661e43beeb"><ac:plain-text-body><![CDATA[

#application['foo'] or #application.foo

ServletContext attributes 'foo'

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3daf46da9607ce36-33856bd5-4c1044f6-817eb0af-ce257608b131a1d1477ab5cd"><ac:plain-text-body><![CDATA[

#attr['foo'] or #attr.foo

Access to PageContext if available, otherwise searches request/session/application respectively

]]></ac:plain-text-body></ac:structured-macro>