0

I was reading through this particular question (and the answer to it by Roman C). I came to know that the format of getters/setters have changed from Struts 2.3.32 and above:

After having updated struts2 from 2.3.16 to 2.3.32(fix the S2-045), the JSP file can not resolve some Objects' fields

Can anybody please emphasize, what exactly are the format changes? (or point me towards the documentation that explains this in detail?)

I have boolean properties and getters/setters in my action class like these and I'm trying to migrate from Struts 2.3.8 to 2.3.34:

private boolean mlaCacheKeep;

public boolean isMlaCacheKeep() {
    return mlaCacheKeep;
}

public void setMlaCacheKeep(boolean mlaCacheKeep) {
    this.mlaCacheKeep = mlaCacheKeep;
}

After the migration, I notice, that for syntax such as these in my JSP...

<s:url id="newMLA" action="populateMlaForm">
    <s:param name="cacheKeep">%{mlaCacheKeep}</s:param>
</s:url>

...the value to <s:param> is not getting 'evaluated'. Instead of a true or a false, it's getting evaluated to something like this %25%7BmlaCacheKeep%7D

Please note: my property name doesn't start with only a single lower case character, but more than one lower case character.

Tatha
  • 131
  • 1
  • 13
  • `%{mlaCacheKeep}` This is simply wrong. It doesn't work in either version. OGNL can be used in the tags. – Aleksandr M Oct 20 '17 at 17:02
  • @AleksandrM Do you mean this is syntactically wrong with respect to Struts 2.3.8? (asking this, as the expression had been getting evaluated historically without any issues, while the app was on Struts 2.3.8, OGNL 3.0.6 and other dependent JARs). Thanks. – Tatha Oct 23 '17 at 06:17
  • @want2learn I'll try out the syntax you suggested and post back about my results. Thanks. – Tatha Oct 23 '17 at 06:18
  • @Tatha Yes. OGNL (`%{...}`) should work inside tag's attributes. – Aleksandr M Oct 23 '17 at 17:29
  • This particular syntax worked perfectly: Thanks a lot, want2learn and Aleksandr M. I wonder how the OGNL was getting evaluated without issues...even between tags, all these years for the app. Possibly, it's mandatory to mention OGNL as part of the "value" attribute only, from some particular Struts 2.3.x on wards? – Tatha Nov 03 '17 at 07:15

0 Answers0