Java Reference
In-Depth Information
JSP
Action Bean
<s:format
value="${actionBean.name}"/>
public T getName()
String
Formatter<T>
T
Figure 5.3: Formatting
Dates
Examples are sometimes worth 1,000 explanations. Here are the differ-
ent combinations of the format types and format patterns understood
by the date formatter, with the results of formatting a value of March 2,
2008 at 2:42 PM EST :
Pattern/Type
"date"
"time"
"short"
3/2/08
2:42 PM
"medium"
Mar 2, 2008
2:42:00 PM
"long"
March 2, 2008
2:42:00 PM EST
"full"
Sunday, March 2, 2008
2:42:00 PM EST
Pattern/Type
"datetime"
"short"
3/2/08 2:42 PM
"medium"
Mar 2, 2008 2:42:00 PM
"long"
March 2, 2008 2:42:00 PM EST
"full"
Sunday, March 2, 2008 2:42:00 PM EST
The formatPattern= may also be any pattern that is understood by Simple-
DateFormat , such as "yyyy-MM-dd HH:mm" , which would return "2008-03-02
14:42" in the previous example.
Numbers
The following are the different format types and patterns understood
by the number formatter, with the results of formatting a value of
2468.24682468 :
Pattern/Type
"number"
"percentage"
"currency"
"plain"
2468.247
246825%
$2468.25
"integer"
2,468
246,825%
$2,468
"decimal"
2,468.246825
246,824.682468%
$2,468.246825
 
 
 
Search WWH ::




Custom Search