I have 2 css classes that hold the background-color property. One class is for general elements and the other is for selected elements. I put the selected_element class on the element according to data i have in my model. This is the css:
.selected_obj {
background-color: #00EE76
}
.general_obj{
/* Othe CSS Properties */
background-color: #d9d9d9;
}
This is my JSP:
<c:forEach items="${myModel.myCollection}" var="obj">
<c:choose>
<c:when test="${obj.id == myModel.selectedObj.id}">
<div class="selected_obj general_obj">
<span>${obj.name}</span>
</div>
</c:when>
<c:otherwise>
<div class="general_obj">
<span>${obj.name}</span>
</div>
</c:otherwise>
</c:choose>
</c:forEach>
When i view the generated HTML, i can see the selected_obj class on the correct elements but the value is overriden by the backgroung-color property value of the general_obj class. How is the correct value selected by the brouwser and how can i overcome this?
class="selected_obj general_obj"toclass="general_obj selected_obj "?