jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kris Schneider" <k...@directthought.com>
Subject Re: [unstandard] Picking through the datetime taglib
Date Tue, 24 Jul 2007 19:13:32 GMT
On 7/23/07, Henri Yandell <flamefew@gmail.com> wrote:
> Here are the tags in the DateTime taglib:
>
> * currentTime    Gets the current time in milliseconds since Jan 1, 1970 GMT.
> * format        Formats a date in milliseconds since Jan 1, 1970 GMT for
> output as a date string.
> * parse         Parses a date string and outputs the time in milliseconds
> since Jan 1, 1970 GMT.
> * timeZone      Create a time zone script variable for use with the parse
> or format tags.
>
> * timeZones     Loop through all time zones.
> * months        Loop through the months of the year.
> * weekdays      Loop through the days of the week.
> * amPms         Loop through the am/pm names.
> * eras         Loop through the era names.
>
> -----
>
> Of the first batch; format and parse are taken of care of in JSTL with
> fmt:formatDate and fmt:parseDate. The currentTime tag is effectively
> handled by doing:
>
> <jsp:useBean id="now" class="java.util.Date" />
>
> I'm never sure whether it's better to educate people in doing such
> things, or if there should be a:
>
> <un:currentTime var="now"/>
>
> Probably it's best to just push towards useBean. Also, the timeZone
> attribute to the two fmt: tags can take a String as well as an Object,
> so presumably that makes that one redundant.

<jsp:useBean> has it's share of semantic "quirks" so it's not always
going to be a useful alternative. It looks like Unstandard already
includes ClassUtils.createInstance(String), and if it was exposed as
an EL function, you could do something like:

<c:set var="currentTime" value="${un:createInstance('java.util.Date')}"/>

> So the question becomes whether there is any value in the iterator
> style tags. I don't see a lot. Any thoughts? I'm tempted to think
> 'deprecate' for datetime and bring nothing into Unstandard.

If I had to recreate the iterator functionality in one of my own apps,
I think I'd be tempted to leverage EL functions instead of tags.
Simply create a set of static utility methods to generate the
collections and then use JSTL iteration. Regardless of how the
functionality is implemented (tags or functions), the bigger question
is whether or not it ought to be in Unstandard. I've never needed
something like it myself, but as Rahul points out, I can see where it
might come in handy.

> Hen

-- 
Kris Schneider <mailto:kris@directThought.com>
directThought  <http://www.directThought.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Mime
View raw message