I was creating a .tagx
file such that it would render a selection of days (within 30-days period) without passing the collection of java.util.Date
.
So far here's what I've done. I can't get the date
variable to increase the value of day
by one. I've tried to re-set the value of date
using <c:set>
tag with the formula index * (24 * 24 * 60 * 1000)
and it returns javax.el.ELException
on that line.
Here's the code I've done so far.
<code>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:fmt="http://java.sun.com/jstl/fmt_rt"
xmlns:spring="http://www.springframework.org/tags"
xmlns:form="http://www.springframework.org/tags/form"
version="2.0">
<jsp:output omit-xml-declaration="yes" />
<jsp:useBean id="date" class="java.util.Date" />
<jsp:directive.attribute name="path" type="String" required="true" rtexprvalue="true" description="The name and id of select tag" />
<jsp:directive.attribute name="classVal" type="String" required="true" rtexprvalue="true" description="The class style to be used by this select" />
<jsp:directive.attribute name="noOfDays" type="Integer" required="true" rtexprvalue="true" description="Number of days to be printed on the selection" />
<select id="${path }" name="${path }" class="${classVal }">
<option value=""></option>
<c:forEach var="index" begin="1" end="${noOfDays }">
<fmt:formatDate value="${date }" pattern="yyyy/MM/dd" var="dateKey" />
<fmt:formatDate value="${date }" pattern="MM/dd (EEE)" var="dateValue" />
<option value="${dateKey }">${dateValue }</option>
</c:forEach>
</select>
</jsp:root>
</code>
I've figured out a way that can solve this by inserting this code at the end of the loop