Нello,
I am programming in a jsp environment, where I need to do the following:
In an iterator inside an < s:if> I have to make a query, that takes a value from one input field and subtracts it with another value from another input field and sets this to a variable, then does the same, but it adds the second value this time, and sets the result to a second variable, and in the end passes both results to the query. The subtraction works, but instead of addition, it just appends the value of the 2nd input field to the value of the first, when setting the second variable. How can I resolve this in s:property? I tried using < s:property value="${"(...)first"+"(...)second"}"/>, but it gives me an error, that it doesn't support runtime expressions. Code:
<s:set name="thequery">
<s:iterator value="#attr.var" status="status">
<%--(...)other unrelevant code--%>
<s:if test="#attr.xinput3[#status.index] != 0">
<%--the one below works fine-->
<s:set name="around1">
<s:property value="#attr.xinput[#status.index]-#attr.xinput3[#status.index]" />
</s:set>
<%--this one just appends the value of xinput3[] to the value of xinput[], instead of adding them-->
<s:set name="around2">
<s:property value="#attr.xinput[#status.index]+#attr.xinput3[#status.index]" />
</s:set>
<s:property value="#attr.xvar[#status.index]" />=<s:property
value="around1" />!<s:property value="around2" />;</s:if>
<s:else>
<%--unrelevant code--%>
</s:else>
</s:iterator>
</s:set>
The result: for, say, xinput[] = 12 and xinput3[] = 2:
10!122;
While I need it to be
10!14;
How can I fix this?