dWebSpec Dictionary
CONTEXT: descriptors->element->caption




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

Results for:

 element.caption 
Prev  Topic  Next

This is the human recognizable label for the element, also used as part of the accessiblity scheme. Within the content source, the convention is to used the label tag to associate a caption to an element id.

<label for="categoryName">Category Name</label>

The need to associate captions with elements in the descriptor, stems from the fact that the services provided by the controller, like auto-population and validation, could be performed iteratively over all fields in the transfer object.

Whenever there are errors, they would be accumulated into messages objects. These errors could then be rendered as feedback to the users. The field names used in transfer objects are not suitable in the provision of such feedback. They should be replaced with captions that match those seen on the page. Furthermore, there might be a need for internationalization of such messages.

The entry of these captions in the descriptor is one step toward achieving this association of captions to fields. The next step is called externalization. This is the process in which these captions would be replaced by keys that are used throughout the application. For example, the key "customerForm.customerId.label" would replace the caption "Customer Id" for field "customerId". There are a lot of considerations that go into selecting a scheme for the naming convention; this would be decided in the design process. There are also restrictions on some platform on the use of non-alphabetic characters, like period, in the keys.

For the specification using dWebSpec, the externalization key could be defined for the caption, as shown below:

            Original String:           Customer ID
            The key entry:             {customerForm.customerId.label}

The enclosure within braces, distinguishes externalized captions from non-externalized ones.

 Struts 1.x  

Struts validation mechanism can use caption to provide user friendly messages for the validation errors.

However, there are implementation steps that must be taken for these captions to be included in such messages.

The label tag, within the content source, would capture the association between an element and its label.

The usefulness of entering the caption in this field is that it provides the first step towards externalization.

The first step towards this process is the designation of keys for these captions. The scheme for arriving at this caption would be based on the convention used by the organization or group. An example of such entry is shown below.

{categoryForm.categoryName}

The label would be reflected in the external file, in a form similar to this.

categoryForm.categoryName=Category Name

The default name for the external file is:

MessageResources.properties

As mentioned earlier, there would be multiples of these files for different languages. There is a convention for the variations in the file names to differentiate language and country, or locales. Example is shown below for the French language variation.

MessageResources_fr.properties

The steps above, would externalize the label strings. To use this externalized strings, and allow internationalization, the literal strings must be replaced with the bean message tag, which would involve converting the source content from the following:

  <label for="categoryName">Category Name</label>
  

To the following:

  <label for="categoryId">
  	<bean:message key ="categoryData.categoryName"/>
  </label>
  

As could be seen under the subject of element validators, the caption is also part of the data that are reflected in the validation configuration file.

Prev Next