OGNL expressions and EL expressions

Format:

                         Execution environment
EL expression          JSP
    ${expression}
OGNL expression    Struts2 (custom tag, struts.xml...)
    Struts2 custom tag attribute value     %{expression}
    struts.xml            $ {expression} The syntax of


OGNL expression :
    %{name} is written like this, which means that %{#name} is preferentially obtained from the stack,
    where # means that %{#user.name} is obtained from the map, which means
    that the name attribute of the user attribute is used to

construct the map . Syntax
    #{'key':'value','key2':'value2'} The syntax of

constructing a list
    {'element1','element2'}

The above are all OGNL syntax regulations


if it is in the Struts2 of the OGNL expression Define how to use the attribute value of the tag to

construct a map
    %{ #{'key':'value','key2':'value2'} }

to construct a list
    %{ {'element1','element2'} }

    %{}The format of the representation , #{} represents the grammar rules.

It should be noted that some OGNL grammars themselves are OGNL expressions, so it is possible to add %{}.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326987331&siteId=291194637