In Struts2 backend, I have an action class instance variable, eg: keyName
. A dynamic key returned to view(JSP).
This keyName
variable is set using a request parameter using POST method. Depending on the request parameter value, the keyName
will vary.
In JSP, I am using <s:property value="getText(keyName)" />
to show the label corresponding to the key given by keyName variable.
When I send an EL expression for example ${90-40}
to keyName
this expression is being evaluated and resulting in showing 50 on the UI.
How can we avoid or prevent such EL injection with getText()
?
Is there any other alternative way instead of <s:property value="getText(keyName)" />
?