|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
jp.terasoluna.fw.web.taglib.DateFormatterTagBase
public abstract class DateFormatterTagBase
Abstract class for the custom tag that formats and outputs the date and time or defines it as scripting variable.
The class of custom tag that formats the date and time, is created by inheriting this class.
Two types of date and time data namely, java.util.Date
type
or java.lang.String
are supported. While formatting
the data of java.lang.String
type, the string should be in
"yyyy/MM/dd HH:mm:ss"
format.
(It can be changed by overriding the getDefaultDateFormat() method or by using the format attribute.)
Abstract method "doFormat(Date date)
" that formats the actual string, is implemented in the subclass. This subclass inherits DateFormatterTagBase
class.
In DateFormatterTagBase
, following attributes are supported.
Attribute name | Default value | Required | Execution time format | Overview |
id |
- | false |
false |
It is specified when the formatted string is to be set to scripting variable and not to be output to response.
In case when the formatted string is set to scripting variable, irrespective of whether the filter attribute is
specified or not, the special HTML characters are not escaped.
|
filter |
true |
false |
true |
At the time of outputting the formatted string, specify whether the special HTML characters are to be escaped.
When id attribute is specified, it is ignored.
|
ignore |
false |
false |
true |
Specify whether to ignore when the bean, which is specified in name attribute, is not found.
If false is specified, JspException exception is thrown when bean is not found.
|
name |
- | false |
true |
Bean name that contains the string to be formatted in the property.
When property attribute is not specified,instance specified in the name attribute needs to be formatted.
In this case, that instance itself should either belong to java.util.Date type or
java.lang.String type(should be in "yyyy/MM/dd HH:mm:ss"
format). When value attribute is specified, it is ignored.
|
property |
- | false |
true |
Property name which is accessed in bean that is specified by
name attribute.It is ignored when value attribute is specified.
|
scope |
false |
true |
(Search order of findAttribute() method) |
Scope to search the bean which is specified in
name attribute.
|
value |
- | false |
true |
String to be formatted.String should be in
"yyyy/MM/dd HH:mm:ss" format.
(It can be changed by overriding the getDefaultDateFormat() method or by using the format attribute)
When value attribute is specified, name attribute and
property attribute are ignored.
|
pattern |
- | true |
true |
Output format to be formatted. Output format specified in pattern
attribute is parsed in subclass of DateFormatterTagBase class.
For details, refer to the documents of subclass.
|
format |
yyyy/MM/dd HH:mm:ss | false |
true |
Date and time format.To change the default value,
override getDefaultDateFormat() method.
|
Following variables are supported in DateFormatterTagBase
.
Variable name | Type | Valid range | Description |
Name specified in id attribute of custom tag |
String |
After start tag | Variable name in case when formatted string is output to a scripting variable and not output in this custom tag. |
DateTag
,
JDateTag
,
Serialized FormField Summary | |
---|---|
private static java.lang.String |
DATE_FORMAT
Default value of date and time format. It is used at the time of parsing the string data as date and time. |
protected boolean |
filter
Check whether the special HTML characters are to be filtered. Default is true . |
protected java.lang.String |
format
Date and time format to be entered. |
protected java.lang.String |
id
Name of scripting variable that can be used on respective page. |
protected boolean |
ignore
Check whether to ignore (nothing is output) when bean is not found. Throws exception when it is not to be ignored. Default is false .
(Throws exception). |
private static org.apache.commons.logging.Log |
log
Log class. |
protected java.lang.String |
name
bean name that includes the data to be formatted. |
protected java.lang.String |
pattern
Pattern that specifies the output format. Pattern should be same as SimpleDateFormat . |
protected java.lang.String |
property
Property name which is accessed in the specified bean. |
protected java.lang.String |
scope
Scope to search the specified bean. |
protected java.lang.String |
value
Value to be formatted(string). |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
pageContext |
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 | |
---|---|
DateFormatterTagBase()
|
Method Summary | |
---|---|
protected abstract java.lang.String |
doFormat(java.util.Date date)
Abstract method that formats the date and time. It is overridden in subclass. |
int |
doStartTag()
Method which is called at the time of starting tag evaluation. |
protected java.lang.String |
getDefaultDateFormat()
Fetches the default value of date and time format. |
java.lang.String |
getFormat()
Fetches the date and time format which is the input. |
void |
release()
Release all allocated resources. |
void |
setFilter(boolean filter)
setFilter method to decide whether special HTML characters that are being output are to be filtered. |
void |
setFormat(java.lang.String format)
Sets the format of date and time which is the input. |
void |
setId(java.lang.String id)
Sets the name of scripting variable. |
void |
setIgnore(boolean ignore)
setIgnore method to decide whether to ignore when bean is not found. |
void |
setName(java.lang.String name)
Sets the bean name that includes the data to be formatted. |
void |
setPattern(java.lang.String pattern)
Sets the pattern that specifies the output format. |
void |
setProperty(java.lang.String property)
Sets the property name which is accessed in spcified bean. |
void |
setScope(java.lang.String scope)
Sets the scope to search the specified bean. |
void |
setValue(java.lang.String value)
Sets the value to be formatted. |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log log
private static final java.lang.String DATE_FORMAT
protected java.lang.String format
protected java.lang.String id
protected boolean filter
true
.
protected boolean ignore
false
(Throws exception).
protected java.lang.String name
protected java.lang.String property
protected java.lang.String scope
protected java.lang.String pattern
SimpleDateFormat
.
protected java.lang.String value
Constructor Detail |
---|
public DateFormatterTagBase()
Method Detail |
---|
protected java.lang.String getDefaultDateFormat()
To change the default value, override this method.
*Default value is "yyyy/MM/dd HH:mm:ss"
public java.lang.String getFormat()
public void setFormat(java.lang.String format)
format
- Date and time formatpublic void setId(java.lang.String id)
setId
in class javax.servlet.jsp.tagext.TagSupport
id
- Scripting variable namepublic void setFilter(boolean filter)
filter
- When the Special HTML character are to be filtered,it is true
public void setIgnore(boolean ignore)
ignore
- It is true
public void setName(java.lang.String name)
name
- bean namepublic void setProperty(java.lang.String property)
property
- Property namepublic void setScope(java.lang.String scope)
scope
- Scopepublic void setPattern(java.lang.String pattern)
pattern
- Patternpublic void setValue(java.lang.String value)
value
- Value to be formattedpublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
SKIP_BODY
javax.servlet.jsp.JspException
- JSP exceptionpublic void release()
release
in interface javax.servlet.jsp.tagext.Tag
release
in class javax.servlet.jsp.tagext.TagSupport
protected abstract java.lang.String doFormat(java.util.Date date)
date
- Date and time
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |