Hello Everyone,
I am not sure if I can tackle the below issue with just html or I need to control it throught my servlet, so posting it on this forum, in case it is a pure html issue, please let me know.
So here is the current situation:
My jsp page gets data from servlet and displays it in a html table. The fields are criteria, median, average...cells of average, median etc are color coded, green, yellow or red, depending on whether the criteria is met or not.
on wish list:
I want the column "criteria" to be of text type so that the user can change the criteria value and see what effect does it have on the colors of columns "average", "median" etc. I do not want to write this changed criteria value back to db, I just want my jsp page to refresh every time user changes value in criteria text box and recalculate the color code for the rest of the columns.
Here is what my jsp page looks like
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://paginationtag.miin.com" prefix="pagination-tag"%>
<html>
<body>
<table border="1">
<c:forEach items="${sheetDataList}" var="releaseData">
<tr>
<td align="center"><input type="text" name="newcriteria" value="${releaseData.releasecriteria}" size="25"></td>
<c:set var="yellowmark" value="${0.25*releaseData.releasecriteria+releaseData.releasecriteria}"/>
<c:choose>
<c:when test="${releaseData.average lt releaseData.releasecriteria}">
<td bgcolor="green" align="center"><c:out value="${releaseData.average}"/></td>
</c:when>
<c:when test="${releaseData.average lt yellowmark}">
<td bgcolor="yellow" align="center"><c:out value="${releaseData.average}"/></td>
</c:when>
<c:when test="${releaseData.average gt yellowmark}">
<td bgcolor="red" align="center"><c:out value="${releaseData.average}"/></td>
</c:when>
</c:choose>
</table>
</body>
</html>
Thanks.