What is the exact use of %{}
notation in Struts 2? Can someone explain with a simple example where the code works when %{}
is used and does not works when its not used?
Asked
Active
Viewed 773 times
3

Roman C
- 49,761
- 33
- 66
- 176

user182944
- 7,897
- 33
- 108
- 174
-
2http://stackoverflow.com/questions/7824576/struts-2-sign-and-sign-in-ognl/7824666#7824666 – Dave Newton Aug 28 '13 at 17:01
1 Answers
2
Used in OGNL to force evaluate the content in brackets as OGNL expression. For example
<s:iterator value = "myAnswers" status="stat">
<s:textfield name = "myAnswers[%{#stat.index}].name"/>
evaluation of the stat.index
should be forced.

Roman C
- 49,761
- 33
- 66
- 176
-
https://securitylab.github.com/research/apache-struts-double-evaluation be careful of forced evaluations – Rohit Salecha Dec 30 '20 at 10:11
-
1@Rogit In this example forced evaluation is safe and used only once, but for different things. – Roman C Dec 30 '20 at 19:47