I have below code, testresultlists
is a list transferred to JSP, and id
is named as row
. The problem is I can't get each row's resultTypeId
during select iterator.
In this <s:if test="%{#result.resultTypeId == #row.resultTypeId">
I tried many ways, can't find a working way to show #row.resultTypeId
result, but it has a value showing in another area.
Could anyone help me?
<display:table name="testresultlists" class="mobile" id="row" style="width:100%;"
cellpadding="0" cellspacing="0" pagesize="50" requestURI="testExecutionAction.action" sort="external">
<display:caption><thead>
<tr class="pageHeader">
<th style="width: 5%;" >No.</th>
<th style="width: 25%;">Test Case Name</th>
<th style="width: 10%;">Result</th>
<th style="width: 25%;">Log</th>
<th style="width: 10%;">Bug Id</th>
<th style="width: 25%;">Comments</th>
</tr>
</thead></display:caption>
<display:column title="Row Number" class="fixTitle1">
<c:out value="${row_rowNum}"></c:out>
</display:column>
<display:column property="testCaseName" />
<display:column title="Row Number" class="fixTitle1">
<select id="${row.resultId}" name="${row.resultTypeId}">
<s:iterator value="#resulttypelist" id="result">
<s:if test="%{#result.resultTypeId == #row.resultTypeId">
<option value="${result.resultTypeId }" selected="selected">${result.resultTypeName}</option>
</s:if>
<s:else>
<option value="${result.resultTypeId }">233${result.resultTypeName}</option>
</s:else>
</s:iterator>
</select>
</display:column>
<display:column property="resultTypeId" />
If you have a getter for resulttypelist
in the action class change this code
<s:iterator value="resulttypelist" var="result">
<s:if test="%{#result.resultTypeId == #attr.row.resultTypeId}">
<option value="${result.resultTypeId}" selected="selected">${result.resultTypeName}</option>
</s:if>
<s:else>
<option value="${result.resultTypeId}">233${result.resultTypeName}</option>
</s:else>
</s:iterator>