C H A P T E R  22

text


<jato:text>

Renders a display field value as plain HTML body text. This tag is only valid when nested inside of a useViewBean or containerView or tiledView tag body.

This tag does not require an enclosing <form> element but must be enclosed by a useViewBean, containerView, or tiledView tag. This tag may not contain any body content.

Example:

<jato:text name="ssn" formatType="string" formatMask="???-??-????"/>

The above would be rendered into the following HTML:

123-45-6789

Attribute Name

Description

Notes

defaultValue

The value to render if the DisplayField view peer's value is null.

RTExpr

escape

Valid values: "true" or "false"

A value of "true" specifies that the value be HTML escaped.

If not specified, a value of "true" is assumed.

 

formatMask

The valid values for the formatMask attribute depend on the value of formatType attribute.

For formatType values of "string" or "alpha":

The format mask consists of any arbitrary combination of static text and the reserved metacharacter "?". Each "?" metacharacter serves as a placeholder for a single character in the value being formatted, proceeding from left to right. A literal "?" can be specified by escaping the "?" character with "\\".

For formatType values of "dec" or "curr":

The format mask consists of two patterns separated by a semicolon: a primary pattern (specifies precision and thousandths separator) and a negative number pattern (see java.text.DecimalFormat for pattern details).

(*See table below.)

 

formatType

Valid values: "string" (also "alpha"), "DEC", or "curr", or "date"

Each type has specific masking rules (see the formatMask attribute for details).

A value of "string" supports the formatting of arbitrary text via the application of a simple text mask. This allows dynamic content to be arbitrarily combined with static text. A value of "alpha" is identical to "string".

A value of "DEC" supports the formatting of numeric values via the application of a numeric mask.

A value of "curr" supports the formatting of currency values via the application of a currency mask. The currency format should simply take a decimal specification and apply the locale specific currency format. Currently, currency formatting is not working due to an unresolved bug.

A value of "date", although legal, at present has no supporting date formatting implementation, due to the fact that the java.text.DateFormat class does not lend itself easily to the generic formatting support that a taglib implementation would require. We are investigating ways around this limitation.

Therefore, it is suggested that developers wishing to apply date formatting implement the begin<fieldName>Display(ChildDisplayEvent event) and/or end<fieldName>Display(ChildContentDisplayEvent event) events and therein take explicit advantage of the date formatting support available in the java.text.DateFormat class.

The JATO implementation of text formatting relies heavily on the java.text package and the format related classes therein. Please see that package for more information. See also the <JATO package>.util.HtmlUtil class.

 

name

The name of the DisplayField peer. This peer must be a child of the current parent ContainerView, TiledView, or ViewBean. The DisplayField name is resolved relative to the current parent view.

The view peer must be of type <JATO package>.view.DisplayField

This name may be a qualified view path, using forward slashes ("/") as delimiters. All components in the path except the last must refer to a ContainerView or a derivative of ContainerView (such as TiledView). Both relative and absolute paths are possible. If a name path begins with a forward slash, the name is assumed to be relative to the root view (the ViewBean). If the path does not begin with a forward slash, the name is assumed to refer to a child relative to the current container. Two dots ("..") may be used to refer to the container that is the parent of the current container.

Examples:

/header/orderList/customerName (absolute from root view)

orderList/customerName (relative to current container)

../footer/orderList/customerName (relative to parent)

Req

 

This tag does not support any JavaScript events.

 


(*See formatMask above.)

Format Type

Format Mask

Sample Value

Rendered Value

string

???-??-????

123456789

123-45-6789

string

??HELLO??

abcd

abHELLOcd

string

??HELLO\\???

abcd

abHELLO?cd

DEC

###0; (-#)

1000000.99

1000001

DEC

#,##0.00; (-#)

1000000.99

1,000,000.99

DEC

###0.00; (-#)

1000000.99

1000000.99

DEC

###0; (-#)

-1000000.99

(-1000001

BUG - Should be

(-1000001)

DEC

###0; (#)

-1000000.99

(1000001

BUG - Should be

(1000001)

DEC

#,##0.00; -#

-1000000.99

-1,000,000.99