こんにちは、
私は次のことを行う必要がある jsp 環境でプログラミングしています
:フィールドとこれを変数に設定し、次に同じことを行いますが、今回は 2 番目の値を追加し、結果を 2 番目の変数に設定し、最後に両方の結果をクエリに渡します。減算は機能しますが、加算の代わりに、2 番目の変数を設定するときに、2 番目の入力フィールドの値を最初の値に追加するだけです。s:property でこれを解決するにはどうすればよいですか? < s:property value="${"(...)first"+"(...)second"}"/> を使用してみましたが、ランタイム式をサポートしていないというエラーが表示されます。コード:
<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>
結果: たとえば、xinput[] = 12 および xinput3[] = 2 の場合:
10!122;
私はそれが必要な間
10!14;
どうすればこれを修正できますか?