Seems simple, but not for me. I can get the current year with:
<jsp:useBean id="date" class="java.util.Date" />
<fmt:formatDate value="${date}" pattern="yyyy" />
But I can’t do a simple -1 in the resulting value because the operations dies there, as html text. I’d love to -1 the year from that ${date} but, well, it’s a date.
I’m looking for a non-scriptlet, preferably JSTL solution.
Thank you in advance.
JSTL converts values in the page based on appropriate coercions rules between object and primitives, so this should work:
Or depending on your JSP version you can directly use
${currentYear}and${currentYear - 1}without the<c:out>.