I am using following code to retain the previous selected value from combo box after page refresh. Please suggest the error in the following code . its working fine when both variable are from jsp but not working in case of comparing ctr1 ==tractor.tractorid;
<%
ArrayList<DozerSelection> tractorInfoList= (ArrayList<DozerSelection>)request.getAttribute("tractorInfoList");
int ctr1=1;
int ctr2=1
%>
<c:when test="${tractorInfoList.size() != 0}">
<p style="float:left;">Tractor Name</p><select name="tractor" onChange="search()">
<c:forEach items="${tractorInfoList}" var="tractor">
// in this case working fine
<option value="${tractor.tractorname}" ${ctr1 ==ctr2 ? 'selected' : ''}>${tractor.tractorname}</option>
// in this case not working
<option value="${tractor.tractorname}" ${ctr1 ==tractor.tractorid ? 'selected' : ''}>${tractor.tractorname}</option>
</c:forEach>
</select>
</c:when>