Hi, Glenn et al.
Following up on the format suggestion, I'd written a generalized format
tag that also handles dates. (Not as nice for dates as the datetime tag,
though =) Maybe the way I did formatting is of some help.
I modeled the "format" attribute after the java.text.Format classes.
Copying directly from my Javadoc:
A format is defined in much the same way as a Java MessageFormat. The
definition string has the form "format_type,style". E.g.,
"decimal,#,###.###" or
"date,short".
The format_type is any of "integer", "decimal", "date", "datetime", "time",
"message" and "choice".
The style options for integers and decimals are "default", "currency",
"percent" and [pattern], where the pattern is any allowed by
java.text.NumberFormat.
The style options for dates are "default", "short", "medium", "long",
"full" and [pattern], where the pattern is any allowed by
java.text.DateFormat.
More examples:
"decimal,currency"
"time,medium"
"integer,#,###"
"datetime,MM-DD-YYYY"
If my docs or source are of any use, just let me know. I've got a fully
implemented FormatTag and ParseTag as described here (not specific to
datetime). Maybe some of the ideas or code can be merged in to this or
another taglib.
Cheers,
Jonathan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Glenn Nielsen
Sent: Wednesday, April 25, 2001 6:57 PM
To: [EMAIL PROTECTED]
Subject: Re: datetime TAGlib -> FormatTag.java
Thanks Lee for the good bug report.
I have implemented a fix for the format tag that allows
it to ignore any whitespace in the body of the tag.
After I review the other datetime taglib feature requests,
I'll update the taglib on the jakarta site.
Thanks,
Glenn
Lee Ball wrote:
>
> Also I have one small bugette to point out with <dt:format> (apologies if
> you've updated it recently).
>
> If you use <dt:format pattern="MM/dd/yyyy
> hh:mm"><dt:currenttime/></dt:format> like in the docs then
> fine but if you try
>
> <dt:format pattern="MM/dd/yyyy hh:mm">
> <dt:currenttime/>
> </dt:format> an exception is thrown because something is coughing out in
the
> parse.
>
> Cheers
> Lee
>
> -----Original Message-----
> From: Mark Femal [mailto:[EMAIL PROTECTED]]
> Sent: 23 April 2001 17:15
> To: [EMAIL PROTECTED]
> Subject: datetime TAGlib -> FormatTag.java
>
> Hi Glenn (et. al.)
>
> Started to use the Jakarta datetime lib and wanted to suggest a few
> improvements (nothing earth-shattering here, just some small suggestions):
>
> 1. Addition of a "date" and "defaultText" attribute:
> date = used for formatting (overrides tag body)
> defaultText = if NumberFormatException when parsing body or date ==
> null this is the text used for defaults
>
> The above allows you to significantly cut down on the amount of code for
> formatting (i.e. you can do something like this:
> <td width="50%">Last Unsuccessful Login:</td>
> <td width="50%">
> <dt:format pattern="M-d-yyyy 'at' hh:mm:ss zzz"
> defaultText=" "
> date="<%= bean.getLastBadLoginDate() %>" />
> </td>
>
> rather than checking to see if lastBadLoginDate == null explicitly and
> also having a default format -- especially useful for table and formatting
> based on data obtained via data sources.
>
> 2. Adjustments to tld: (ADD)
>
> <attribute>
> <name>date</name>
> <required>false</required>
> <rtexprvalue>true</rtexprvalue>
> </attribute>
> <attribute>
> <name>defaultText</name>
> <required>false</required>
> <rtexprvalue>false</rtexprvalue>
> </attribute>
>
> excellent work BTW on the taglib! I'll have more suggestions maybe
> later...
--
----------------------------------------------------------------------
Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder |
MOREnet System Programming | * if iz ina coment. |
Missouri Research and Education Network | */ |
----------------------------------------------------------------------