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++) { %> <%=2003-i%> <% } %> I wish to do something like: How to compute the CurrentYear? Thanks a lot, Erez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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: <%=(new java.util.GregorianCalendar()).get(java.util.Calendar.YEAR)%> 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++) { %> <%=2003-i%> <% } %> I wish to do something like: 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]
RE: current year in JSP
Thanks it worked fine. Erez -Original Message- From: Bailey, Shane C. [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 7: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: <%=(new java.util.GregorianCalendar()).get(java.util.Calendar.YEAR)%> 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++) { %> <%=2003-i%> <% } %> I wish to do something like: 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]
RE: current year in JSP
You can make it simpler by using JSTL: 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: <%=(new java.util.GregorianCalendar()).get(java.util.Calendar.YEAR)%> 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++) { %> <%=2003-i%> <% } %> I wish to do something like: 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]