我正在创建一个.tagx
文件,以便在不传递java.util.Date
.
到目前为止,这就是我所做的。我无法让date
变量的值增加day
一。我试图用公式重新设置date
使用<c:set>
标签的值,index * (24 * 24 * 60 * 1000)
它会javax.el.ELException
在该行返回。
这是我到目前为止所做的代码。
<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>