I need the following logic to occur:
- Get the shippingDate from the db
- If the shippingDate has value (not empty), display it
- Otherwise, set the shippingDate that is displayed on the page to today's date. This way the user can just submit the page and the default value (today's date) will be written to db. The user can also choose to change that value.
This is what I have so far:
myJsp.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
...
<% String todaysDate = cm.GetMonth() + "/" + cm.GetDay() + "/" + cm.GetYear();%>
...
<c:forEach var="i" items="${bean.results}">
<c:choose>
<c:when test="${empty i.shippingDate}">
<c:set var="shippingDate" value="<%=todaysDate%>" scope="request"></c:set>
</c:when>
</c:choose>
<TD>
<INPUT TYPE="text" NAME="shippingDate" id="shippingDate" value="${i.shippingDate}"/>
</TD>
Above code works when there is value in db, but it doesn't set shippingDate to today's date if nothing is returned from db.
Does anyone see what I am doing wrong?