Sun Java System Portal Server 7.1 Technical Reference

Attributes

You can pass two kinds of attributes to the Desktop library tags:

String

The simplest way to pass in an attribute is to specify it as a string, for example:


<dt:sometag attribute1="myAttribute"/>

The string myAttribute becomes the value of attribute1. If a tag expects an integer attribute, use the following:


<dt:sometag attribute1="12345"/>

The tag uses the corresponding Java classes (java.lang.Integer) to translate the string to an integer value. The same applies to all the primitive Java types (boolean, int, and so on).

Reference

Sometimes you cannot pass in an attribute as a string. For example, it is impossible to specify a provider object as a string. In this case, the attribute needs to be passed in as a reference defined in the pageContext. You do so by concatenating the character $ with the name of the object stored in the pageContext, for example:


<dt:sometag attribute1="$myAttribute"/>

In this example, the value of attribute1 is whatever object is stored in the pageContext. The method pageContext.findAttribute() is used, not getAttribute(). So it is possible to define some value in the request object and pass this object in as a reference.


Note –

This mechanism is the main form of communication between tags in the Desktop tag library as well as other tags in other tag libraries (for example, jsptl).