I am trying to do something similar to this question , but the answers do not fix my problem. I am using Struts2 version 2.3.28.1.
I am trying to access data in a session using a <s:property>dynamic value tag and string literal.
If I do this:
<s:property value="#session.data_1"></s:property>
Then the correct data is displayed. Now when I try the following:
<s:set var="part1" value="#variable.code"></s:set>
<s:set var="part2" value="'#session.data_'+#part1"></s:set>
<s:property value="part2"></s:property>
<s:property value="%{part2}"></s:property>
<s:property value="%{#part2}"></s:property>
<s:property value="#attr[#part2]" default="Not working"></s:property>
<s:property value="(#part2)" default="Not working"></s:property>
<s:property value="%{(#part2)}" default="Not working"></s:property>
What is displayed:
#session.data_1
#session.data_1
#session.data_1
Not working
#session.data_1
#session.data_1
(Yes, I tried all the possible combinations that I could think of, even if they do not make sense ...)
How can I make a tag <s:property>evaluate #part2instead of interpreting as a string literal? In my understanding, I %{}should have done the trick, but no.