您可以使用HTML选择的Attribute。只需比较ID,然后将其设置为匹配即可。
样例代码:
<select id="locationCountry" > <option value="">Country</option> <c:forEach items="${countrieDetail}" var="theObject"> <option value="${theObject.countryId}" <c:if test="${theObject.countryId == theObject2.countryId }">selected</c:if>> ${theObject.countryName} </option> </c:forEach></select>


