[prev in list] [next in list] [prev in thread] [next in thread]
List: taglibs-dev
Subject: cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt FormatDateSuppor
From: luehe () apache ! org
Date: 2002-02-27 19:01:51
[Download RAW message or body]
luehe 02/02/27 11:01:51
Modified: standard/conf fmt-rt.tld fmt.tld
standard/doc/web ReleaseNotes.html
standard/examples/web/format FormatDateTime.jsp
standard/src/org/apache/taglibs/standard/tag/common/fmt
FormatDateSupport.java
Log:
Allow <fmt:formatDate> to have a body. If its 'value' attribute is
missing, and its body content is empty after trimming,
<fmt:formatDate> formats the current time and date.
Revision Changes Path
1.11 +1 -1 jakarta-taglibs/standard/conf/fmt-rt.tld
Index: fmt-rt.tld
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/conf/fmt-rt.tld,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- fmt-rt.tld 27 Feb 2002 00:35:15 -0000 1.10
+++ fmt-rt.tld 27 Feb 2002 19:01:50 -0000 1.11
@@ -327,7 +327,7 @@
<name>formatDate</name>
<tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.FormatDateTEI</tei-class>
- <body-content>EMPTY</body-content>
+ <body-content>JSP</body-content>
<description>
Formats a date and/or time using the supplied styles and pattern
</description>
1.12 +1 -1 jakarta-taglibs/standard/conf/fmt.tld
Index: fmt.tld
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/conf/fmt.tld,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- fmt.tld 27 Feb 2002 00:35:15 -0000 1.11
+++ fmt.tld 27 Feb 2002 19:01:50 -0000 1.12
@@ -379,7 +379,7 @@
<name>formatDate</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.FormatDateTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.FormatDateTEI</tei-class>
- <body-content>EMPTY</body-content>
+ <body-content>JSP</body-content>
<description>
Formats a date and/or time using the supplied styles and pattern
</description>
1.7 +3 -0 jakarta-taglibs/standard/doc/web/ReleaseNotes.html
Index: ReleaseNotes.html
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/doc/web/ReleaseNotes.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ReleaseNotes.html 27 Feb 2002 00:35:15 -0000 1.6
+++ ReleaseNotes.html 27 Feb 2002 19:01:50 -0000 1.7
@@ -177,6 +177,9 @@
<fmt:parseDate> or <fmt:parseNumber>, and the result can
then be used with <fmt:formatDate> or <fmt:formatNumber>,
respectively.</li>
+ <li>Allow <fmt:formatDate> to have a body. If its 'value' attribute is
+ missing, and its body content is empty after trimming,
+ <fmt:formatDate> formats the current time and date.</li>
</ul>
</dd>
1.5 +2 -1 \
jakarta-taglibs/standard/examples/web/format/FormatDateTime.jsp
Index: FormatDateTime.jsp
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/examples/web/format/FormatDateTime.jsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FormatDateTime.jsp 6 Dec 2001 20:19:50 -0000 1.4
+++ FormatDateTime.jsp 27 Feb 2002 19:01:50 -0000 1.5
@@ -10,7 +10,8 @@
<ul>
<li> Formatting current date as "GMT":<br>
<fmt:timeZone value="GMT">
- <fmt:formatDate type="both" dateStyle="full" timeStyle="full"/>
+ <fmt:formatDate type="both" dateStyle="full" timeStyle="full">
+ </fmt:formatDate>
</fmt:timeZone>
<li> Formatting current date as "GMT+1:00", and parsing
1.10 +11 -4 \
jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java
Index: FormatDateSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FormatDateSupport.java 27 Feb 2002 00:35:15 -0000 1.9
+++ FormatDateSupport.java 27 Feb 2002 19:01:51 -0000 1.10
@@ -70,7 +70,7 @@
* @author Jan Luehe
*/
-public abstract class FormatDateSupport extends TagSupport {
+public abstract class FormatDateSupport extends BodyTagSupport {
//*********************************************************************
// Public constants
@@ -167,13 +167,20 @@
/*
* If no date or time is given, the current date and time are used.
+ */
+ if (value == null) {
+ String bcs = getBodyContent().getString();
+ if ((bcs == null) || (value = bcs.trim()).equals("")) {
+ value = new Date();
+ }
+ }
+
+ /*
* If the date and/or time is given as a string literal, it is first
* parsed into an instance of java.util.Date according to the default
* pattern of the "en" locale.
*/
- if (value == null) {
- value = new Date();
- } else if (value instanceof String) {
+ if (value instanceof String) {
DateFormat parser
= DateFormat.getDateInstance(DateFormat.DEFAULT,
Locale.ENGLISH);
--
To unsubscribe, e-mail: <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic