|
The output text is implemented
with the bean:write tag. This tag has a special attribute for setting the
format string as literal or as key to externalized string.
Text could appear on a page
without association with HTML or xHTML tags. Any text within the body tag
would be displayed. However text could be mock position holders, for
dynamically generated texts. Those text segments must be wrapped with
dWebSpec annotation for outputText, as shown in the example below.
<!-- aws:element type="outputText" id="subTotal" -->
????????????? $205.38
<!-- /aws:element -->
It could easily be seen that the
mock value would show in the browser, meanwhile the annotation would
represent the existence of dynamic output.
It is this representation that
would be coupled with the corresponding entry in the element descriptor.
The relevant attributes for
outputText are as follows:
id, component-id, value, formatter(externalized or
literal), visible,?enable,
It is the annotation within the
source content that would be combined with the entries in the descriptors,
which would be use to formulate the implementation syntax.
In the example below, the value
binding is used to obtain the name/property entry, whereas the formatter
entry is represented in the format attribute.
<!-- aws:element type="outputText" id="subTotal" -->
<bean:write name="orderDetailsForm" property="subTotal"
format="?#####.00"/>
<!-- /aws:element -->
Where the latter entry is
externalized, it is format key attribute that would be used as shown below:
<!-- aws:element type="outputText" id="subTotal" -->
<bean:write name="orderDetailsForm" property="subTotal"
formatKey="format.currency"/>
<!-- /aws:element -->
|
|
The standard output text, allow
the display of information derived from the model. This is information is
represented in the element descriptor value binding.
There is an alternative source
of dynamic information, which is used mainly for internationalization.
Strings could be stored in message resources, with key provided by their
retrieval.
The implementation would use the
bean:message tag for producing these messages or texts.
<bean:message key="categoryData.title"/>
Like the standard output text,
the starting point is the representation in the source content. Wherever such
text segments exist, they would be wrapped with the outputText annotation.
Whereas the value specification
for the standard outputText is specified in the element descriptor, the value
for externalized messages could and should be specified in place.
<title>
<!-- aws:element type="outputText" value="{categoryData.title}" -->
Category Data
<!-- /aws:element -->
</title>
On some platforms, the key is in
object.property form, which would fit squarely with other descriptor value
entries. Whereas in others, special characters and additional periods could
be included in the key. Whichever is the case, leave the keys in the source
content could reduce the bloat in the descriptor entries. Since, depending on
the site content, the internationalized text segments could be many.
The implementation involving two
steps. 1) Moving the key and text segment into message resources.
This on the Struts platform
would be the application.resource entry:
categoryData.title=Category Data
2) The annotation with the body would
then be replaced with the bean message tag, as shown below.
<title>
<<bean:message key="categoryData.title"/>
</title>
NOTE: The bean:message tag is a means of introducing
externalized strings. It should however be noted, that Struts provides means
of introducing externalized strings in other forms. Many tag attributes could
use externalized strings, by using alternate attributes that are soley meant
for externalized entrits.
We
provide the list of such attributes that have alternative means of
specifications below.
These
are examples of such attributes:
format formatKey Used with bean:write
alt altKey Used by form elements
page pageKey Used with html:image, html:img
src srcKey Used with html:image
title titleKey Used by form elements
|
|
Captions for fields are captured
with this element
This is captured in the source
content with the HTML label for tag as shown below.
<th class="rightLabel">
<label for="categoryName">Category Name</label>
<font color="red">*</font>
</th>
It is also represented in the
descriptor as the caption for the element that the label is for; the
identifier in the "for" attribute, would be the identifier for the element in
the descriptor.
The representation of the label
as the caption in the descriptor does not provide any additional useful
information. The repetition is only useful as a step towards externalization
of the caption, which would be reflected in the manner shown below.
Category Name
{catgory.name}
That is, replacing the caption
string with an externalized key.
The implementation would then
start with the movement of the key and value into message resources.
Followed by the replacement of the
string caption with the bean message tag. The key would be as specified in
the element descriptor.
The result is as follows.
<td align="left">
<label for="categoryId">
<bean:message key="categoryData.categoryName"/>
</label>
</td>
|