【发布时间】:2013-10-29 05:05:56
【问题描述】:
我正在创建一个.tagx 文件,这样它就可以在不传递java.util.Date 的集合的情况下呈现选择的天数(30 天内)。
到目前为止,这就是我所做的。我无法让date 变量将day 的值增加一。我尝试使用<c:set> 标记和公式index * (24 * 24 * 60 * 1000) 重新设置date 的值,它在该行返回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>
【问题讨论】:
标签: jsp jstl spring-roo tagx