dWebSpec Dictionary
CONTEXT: descriptors->element->formatter




All Details Standard Only Platform Only
Structured Web info and helpTechnologies
 Home Page
 Product Page
 Download Page
 Feedback
Javascript Tree Menu

Results for:

 element.formatter 
Prev  Topic  Next

A formatter could be specified for an element. These are strings that represent mask, currency, date or other applicable formats. As the name of the attribute connotes, this could also be in form of a formatter class.

The standard dWebSpec format parameters are listed below.

Shortdateshort date MM/dd/yy
LongdateExample: December 10, 2008
dday, in date pattern
MMonth, in date pattern
yyear, in date pattern
h,Hhour, 12 hour or 24 hour, in date time pattern
mminutes in date time pattern
sseconds in date time pattern
9 or 0numeric digits
#numeric digits allowing leading or trailing zeroes

The single characters are combined or repeated to form a format string like MM/dd/yy.

The parameter could be specified as an internationalized key, as shown in example below:
{dateformat.long}

Where the specified string would be the key to the internationalized format strings. This would allow the introduction of different format strings for different locale.

 Struts 1.x  

For Struts platform, formatting involves the inputText and outputText elements.

The specification of format is based on Java formatting that is based on these classes.

  java.text.SimpleDateFormat
  java.text.NumberFormat
  java.text.DecimalFormat
  

outputText

The implementation for output text would used the bean:write tag; which has the format attribute, which could include the specified format string as shown below.

<bean:write name="dueDate" format="MM/dd/yyyyy"/>

It could also be externalized into a key.

<bean:write name="dueDate" formatKey="fmt.date.short"/>

inputText

Struts does not provide direct support for formatting input texts, either on first display on the page, or during or after editing the text.

There are however some common patterns that would provide the formatting as logic within the form bean; these also could accommodate internationalization. For on screen formatting, client scripting would need to be employed.

Prev Next