Search code examples
javastruts2static-methodsognl

struts2 2.3.20 ognl allowStaticMethodAccess


I updated my project to Struts2 version 2.3.20 . Now all cases in my JSPs that uses static method access do not work.

ie.

<s:set var="linkEscaped"
 value="@org.apache.commons.lang.StringEscapeUtils@escapeHtml(#attr.myObject.link)" />

I already have set in my struts.properties ->

struts.ognl.allowStaticMethodAccess=true

and tried in struts.xml ->

<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>

with no success. Does anyone know what has changed and what do I need to do to enable them again?


Solution

  • Since static methods will not be able to be used in future releases, I decided to refactor the parts of the project that use them. The sooner the better.

    So in y "BaseAction" I have created the methods I need and they call those methods. This way only the "safe" methods I allow can be used in the jsp.