You can make it simpler by using JSTL: <jsp:useBean id='fCurrentDate' class='java.util.Date'/> <fmt:formatDate var='currentYear' value='${currentDate}' pattern='yyyy'/>
You should ask these type of questions to the JSTL list. It's a very good list and will be more helpful than asking a JSTL question to a Struts list ;) -Tim -----Original Message----- From: Bailey, Shane C. [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 1:59 PM To: 'Struts Users Mailing List' Subject: RE: current year in JSP The problem is that something like that (determining current date) should be done somewhere else besides the JSP if you want scriptlets totally out of your JSP. But if you don't want to do it somewhere else then the single expression scriptlets aren't too bad to have in your JSP: <bean:define id="currentYear" > <%=(new java.util.GregorianCalendar()).get(java.util.Calendar.YEAR)%> </bean:define> This is untested code but it should work (or a variation). -----Original Message----- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 2:54 PM To: 'Struts Users Mailing List' Subject: current year in JSP I have a scriptlet in my JSP which I wish to rewrite using JSTL and tags and to get rid of the java code. How can I perform this? <% for (int i = 30; i < 90; i++) { %> <html:option value="<%=Integer.toString(2003-i)%>" ><%=2003-i%></html:option> <% } %> I wish to do something like: <c:forEach var="age" begin="30" end="90"> <html-el:option value='${CurrentYear - age}' > <c:out value='${CurrentYear - age}' /> </html-el:option> How to compute the CurrentYear? Thanks a lot, Erez --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]