I am new to struts2 and confused by the elements '#', '%' and '
- jstl 🈲 🎀 🍂
. There are several ways to use it: ...">
- jstl 🈲 🎀 🍂

The difference between '#', '%' and '$'

I am new to struts2 and confused by the elements '#', '%' and '$'. There are several ways to use it:

${user.name}
%{user.name}
<s:radio list="#{key1:value1,key2:value2}" />

Can someone give me an explanation and examples?

+3
source share
1 answer

Simply put

If $ {user.name} in the jsp page, this is an EL expression. If $ {user.name} is in struts.xml, this is an OGNL expression.

If% {user.name} on the jsp page, this is an OGNL expression.

Final, # {key1: value1, key2: value2} is an OGNL expression, it means creating a map that maps key1 to value1 and key2 to value2.

BTW: # {key1: value1, key2: value2} % {}, % {# {key1: value1, key2: value2}}, struts2 , OGNL , % {} .

+4

Source: https://habr.com/ru/post/1708978/


All Articles