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="e68f8db7d6970859-439ee467-43f14869-84eb943c-18c80037b0d40a0cc0563ccd"><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="9c7643d79cd68b16-9300ffba-47df41c2-b240ab65-7a99458cdd34022e0cfb733d"><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="c2ae58e2f8378477-8d12ef15-486c4db5-ad398360-133a6f3023bf79cc2ee77687"><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="4d35172ef5f3dbb2-a9c3b7b6-42ee42e4-b634ad8b-233a10796e76b53f0a47e1f8"><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="f320709bb8c12baf-250c2f4a-4ad8406a-8199bf7d-981fc21e04c963f4db66884d"><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="e81a92e51e8afece-803a4a45-4a40466f-941ab91a-9e2783fdc95f1094747f0841"><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="ffb81201d3110ca1-c59783dc-44c4481b-9fb697bb-5df15b334028adfab3199313"><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="be605396343716f3-9b01db8f-470648cc-a591862c-1bc8dbec582bb6413f15802c"><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="22427ce652e45aff-9c1cbd82-4e8b42fd-8aab8094-918dcba3ce3ed5ffa1c3c778"><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>