I have an Action class and a Data class like below
Action Class
public class TestAction extends ActionSupport{
private Data aData;
}
Data class
public class Data {
private char v1;
private char v2; etc till 17;
public accessors for all variables above;
}
My jsp is like below
JSP snippet
<s:set var="varName" value="'data.v'"/>
<s:iterator var="idx" begin="1" end="17">
<s:set var="prop" value="#varName+#idx"/>
<s:property value="<WHAT TO DO HERE TO GET THE VALUES STORED IN THE VARIABLES>"
</s:iterator
Whatever I put in the s:property
tag's value
attribute, (%{#prop}, #arr#prop, [prop]), I get the literal Strings data.v1, data.v2, ... data.v17
in my output and NOT the values stored in the data.v1, data.v2, etc. variables.
Can you please let me know how I can get the values stored in the data object.
Edit based on duplicate question suggestion struts-2-warning-the-default-value-expression-contains-evaluated-to-nullnu
The suggested question is a double evaluation of the value in the variable, whereas what I am looking for is a double evaluation of the variable. After submitting my original question, I came across another question with a comment that the double evaluation I am looking for is not supported. I have mentioned this as a comment in my own question, requesting for confirmation as it was not quite clear in the other question as well.