|
|||||||||
| Home >> All >> org >> apache >> taglibs >> [ datetime overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.taglibs.datetime
Class FormatTag

java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.datetime.FormatTag
- All Implemented Interfaces:
- javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag
- public class FormatTag
- extends javax.servlet.jsp.tagext.BodyTagSupport
JSP Tag format, used to format a Date for display.
The Date as a long in milliseconds is obtained from the body of the tag.
Uses the optional attribute pattern as the time pattern string to use when formatting the Date.
The optional attribute timeZone can be set to the id of a timeZone script varaible so that the Date if adjusted for that timeZone.
If the optional attribute locale is true, the Date is formatted for the clients locale if known.
The optional attribute date can be set to a Date object using a runtime expression value. If set, date will be used instead of the tag body.
The optional attribute default can be set to a default string to output if the date object doesn't exist or the tag body is not a valid date. If no default is set, the string "Invalid Date" is output.
The optional attribute localeRef can be used to specify the name of a page, session, application, or request scope attribute of type java.util.Locale to use.
JSP Tag Lib Descriptor
<name>format</name>
<tagclass>org.apache.taglibs.datetime.FormatTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>Formats a date for output.</info>
<attribute>
<name>pattern</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>patternId</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>timeZone</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>locale</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>date</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>default</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>localeRef</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>symbolsRef</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
| Field Summary | |
private java.util.Date |
date
|
private java.lang.String |
default_text
|
private boolean |
locale_flag
|
private java.lang.String |
localeRef
|
private java.util.Date |
output_date
|
private java.lang.String |
pattern
|
private java.lang.String |
patternid
|
private java.text.DateFormatSymbols |
symbols
|
private java.lang.String |
symbolsRef
|
private java.lang.String |
timeZone_string
|
| Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
bodyContent |
| Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
| Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
| Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
EVAL_BODY_AGAIN |
| Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
| Constructor Summary | |
FormatTag()
|
|
| Method Summary | |
int |
doAfterBody()
Method called at end of format tag body. |
int |
doEndTag()
Method called at end of Tag |
int |
doStartTag()
Method called at start of tag, always returns EVAL_BODY_TAG |
void |
release()
Release state. |
void |
setDate(java.util.Date date)
Set the date to use (overrides tag body) for formatting |
void |
setDefault(java.lang.String default_text)
Set the default text if an invalid date or no tag body is given |
void |
setLocale(boolean flag)
Locale flag, if set to true, format date for client's preferred locale if known. |
void |
setLocaleRef(java.lang.String value)
Provides a key to search the page context for in order to get the java.util.Locale to use. |
void |
setPattern(java.lang.String str)
Set the pattern to use when formatting Date. |
void |
setPatternId(java.lang.String str)
Set the pattern to use when parsing Date using a script variable attribute. |
void |
setSymbolsRef(java.lang.String symbolsRef)
Provides a key to search the page context for in order to get the java.text.DateFormatSymbols to use |
void |
setTimeZone(java.lang.String tz)
Set the time zone to use when formatting date. |
| Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doInitBody, getBodyContent, getPreviousOut, setBodyContent |
| Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.servlet.jsp.tagext.Tag |
getParent, setPageContext, setParent |
| Field Detail |
locale_flag
private boolean locale_flag
pattern
private java.lang.String pattern
patternid
private java.lang.String patternid
timeZone_string
private java.lang.String timeZone_string
date
private java.util.Date date
default_text
private java.lang.String default_text
localeRef
private java.lang.String localeRef
symbolsRef
private java.lang.String symbolsRef
symbols
private java.text.DateFormatSymbols symbols
output_date
private java.util.Date output_date
| Constructor Detail |
FormatTag
public FormatTag()
| Method Detail |
doStartTag
public final int doStartTag()
throws javax.servlet.jsp.JspException
- Method called at start of tag, always returns EVAL_BODY_TAG
doAfterBody
public final int doAfterBody()
throws javax.servlet.jsp.JspException
- Method called at end of format tag body.
doEndTag
public final int doEndTag()
throws javax.servlet.jsp.JspException
- Method called at end of Tag
release
public void release()
- Description copied from class:
javax.servlet.jsp.tagext.BodyTagSupport - Release state.
setLocale
public final void setLocale(boolean flag)
- Locale flag, if set to true, format date
for client's preferred locale if known.
setTimeZone
public final void setTimeZone(java.lang.String tz)
- Set the time zone to use when formatting date.
Value must be the name of a timeZone tag script
variable ID.
setPattern
public final void setPattern(java.lang.String str)
- Set the pattern to use when formatting Date.
setPatternId
public final void setPatternId(java.lang.String str)
- Set the pattern to use when parsing Date using a script variable
attribute.
setDate
public final void setDate(java.util.Date date)
- Set the date to use (overrides tag body) for formatting
setDefault
public final void setDefault(java.lang.String default_text)
- Set the default text if an invalid date or no tag body is given
setLocaleRef
public void setLocaleRef(java.lang.String value)
- Provides a key to search the page context for in order to get the
java.util.Locale to use.
setSymbolsRef
public void setSymbolsRef(java.lang.String symbolsRef) throws javax.servlet.jsp.JspException
- Provides a key to search the page context for in order to get the
java.text.DateFormatSymbols to use
|
|||||||||
| Home >> All >> org >> apache >> taglibs >> [ datetime overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC