Thank you in advance for your time.
I need to pre-select the switch if it has a saved value. I need to compare 2 lines in the evaluation to determine this.
(I cannot use <s:radioat the moment because of some business rules that I need to attach based on other input elements in the form).
I tried to make the <s:setvalue of the stored identifier inside s:iterate, as shown below, and then compare them as shown below, but obviously I did not understand it.
<s:set var="savedId" value="%{flag.problemId}"/>
<s:iterator value="problemIdList">
<s:set var="currentId" value='<s:property value="id"/>' />
<s:if test="%{#currentId.equals(#savedId)}" >
<input checked="checked" type="radio" name="problemId" id="problemId" value='<s:property value="id"/>'/> <s:property value="description"/> <br/>
</s:if>
<s:else>
<input type="radio" name="problemId" id="problemId" value='<s:property value="id"/>'/> <s:property value="description"/> <br/>
</s:else>
</s:iterator>
Basically, I need to compare two lines, my code is below. I know that I can not compare with equals (), as I have below - any ideas?
Thank!
<s:set var="savedId" value="%{flag.problemId}"/> <s:iterator value="problemIdList">
<s:if test=' <s:property value="id"/>.equals(<s:property value="savedId"/>) '>
<input checked="checked" type="radio" name="problemId" id="problemId" value='<s:property value="id"/>'/> <s:property value="description"/> <br/>
</s:if>
<s:else>
<input type="radio" type="radio" name="problemId" id="problemId" value='<s:property value="id"/>'/> <s:property value="description"/> <br/>
</s:else>
Regards, VeeCan
source
share