jp.terasoluna.fw.web.taglib
Class JDateTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by jp.terasoluna.fw.web.taglib.DateFormatterTagBase
          extended by jp.terasoluna.fw.web.taglib.JDateTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class JDateTag
extends DateFormatterTagBase

Implementation class of jdate tag that converts date and time data into wareki format.

While doing the formatting, the date and time data should not be converted into wareki era ("showa", "S"etc) or wareki year(christian era "2002" but it should be converted into heisei "14"year etc)and Japanese notations of days ("Monday", "Monday" etc).

Formatting is performed according to the format specified in pattern attribute. In JDateTagclass, same as DateTag class, the output format string which is specified in pattern attribute is parsed as the time pattern string of java.text.SimpleDateFormat class and formatted. While parsing the time pattern string, following points differ from the DateTag class.

Symbol Significance in  SimpleDateFormat   Significance in  JdateTag 
G Era
Example:AD
Wareki era
Ex:HHHH -> Heisei
HHH -> H
y Year(Wastern calendar)
Ex:2002
Year(Wareki)
Ex:14
E Day
Ex:Tuesday
Day(Japanese notation)

Ex:EEEE -> Wednesday
EEE -> Wed

The above-mentioned wareki era and wareki year are converted by using the dateToWarekiString(String pattern, java.util.Date date) method of DateUtil class. Regarding the configuration method of wareki era and wareki year and the constraints related to the convertible year, refer to DateUtil.

The day can be converted by specifying the locale in "ja" in SimpleDateFotmat constructor. For the details of locale and time pattern string, refer to the documents of java.text.SimpleDateFormat class.


Attribute upported by tag

Refer to DateFormatterTagBase.


Scripting variable of custom tag

Refer to DateFormatterTagBase.


How to use

To convert the "field001" property value of "form0001" bean into the specified format and output the value, see the following example.

  <t:jdate name="form0001"
              property="field001"
              pattern="GGGGyyYear MM dd(EEEE) hhmmss" />

 => Heisei 26th July 2002(Friday) 11hr:04 mins 07 seconds

  <t:jdate name="form0001"
              property="field001"
              pattern="G. yyMMdd(E) hhmmss" />

 => H. 26th July 2002(Friday) 11hrs04mins07seconds
 

To set the property of above bean to "formatted" scripting variable without outputting it to the custom tag, see the following example.

  <t:jdate id="formatted"
              name="form0001"
              property="field001"
              pattern="GGGGyyMMdd(EEEE) hhmmss" />
 

To specify the date and time data in the value attribute of custom tag without fetching the data from the bean, see the following example.

  <t:jdate value="2002/07/25 04:56:23"
              pattern="GGGGyyMMdd(EEEE) hhmmss" />
 

See Also:
SimpleDateFormat, DateUtil, DateFormatterTagBase, Serialized Form

Field Summary
private static long serialVersionUID
          Serial version ID
 
Fields inherited from class jp.terasoluna.fw.web.taglib.DateFormatterTagBase
filter, format, id, ignore, name, pattern, property, scope, value
 
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
JDateTag()
           
 
Method Summary
protected  java.lang.String doFormat(java.util.Date date)
          Convert the date and time data into wareki format by referring to the the format specified in pattern attribute.
 
Methods inherited from class jp.terasoluna.fw.web.taglib.DateFormatterTagBase
doStartTag, getDefaultDateFormat, getFormat, release, setFilter, setFormat, setId, setIgnore, setName, setPattern, setProperty, setScope, setValue
 
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

serialVersionUID

private static final long serialVersionUID
Serial version ID

See Also:
Constant Field Values
Constructor Detail

JDateTag

public JDateTag()
Method Detail

doFormat

protected java.lang.String doFormat(java.util.Date date)
Convert the date and time data into the wareki format by referring to the format specified in pattern attribute.

Specified by:
doFormat in class DateFormatterTagBase
Parameters:
date - Date and time data
Returns:
String in which date and time data is converted into wareki format