Provides custom tags for information from an asset database to be inserted into a JSP. In this environment, custom tags are typically either models or views. The custom tag Asset is a model type of custom tag. The AssetDatabase custom tag is more of an environment setting/ease-of-use type of tag.
AssetDatabase
Asset
Transformation beans can pair up with a variety of models, several of which access the
asset database. Currently the only two transformation beans that interact with the asset
database models are Image and StaticText. Both of these beans may have a
link to another URL or not. Therefore, as of now there are four models that access the
asset database that you can use:
The model that you select for the Asset tag is specified in the type= parameter:
| Use this type... | ...to get this model |
| image | AssetImageModelAdapter |
| imagelink | AssetImageLinkModelAdapter |
| text | AssetStaticTextModelAdapter |
| link | AssetTextLinkModelAdapter |
In addition, there are lookup parameters used to narrow down the search in the asset database. One is the elementName. Each web element defined in the asset database has a unique name, and doing the lookup based on elementName will return just those portions of the web element that you need. elementID works in a similar fashion; the elementID is a number or GUID generated when the web element is defined by collect the assets it needs from the image table, the text table, and the URL table of the asset database. The third form of lookup is by content or by content and usage. This type of lookup retrieves any assets that fit the search criteria requirements and forms them into web elements, whether the assets were initially defined as part of a web element or not, and can retrieve the latest assets entered into the database.
Usage
The Asset custom tags may either precede the transformation bean
that they're paired with or be nested inside the transformation bean. These are examples
of the Asset tag preceding the transformation bean.
<sasads:Asset id="foundations" elementName="Foundations"
database="Pubcat" type="imagelink" />
<sasads:Image useAsFormElement="false" model="foundations" />
places an image on the page and gives it a URL to go to if selected. The entry in the
asset database will be found under the name Foundations. The Image transformation
bean will find the asset model under the name foundations.
<sasads:Asset id="empire" elementName="Empire"
database="Pubcat" type="link" />
<sasads:StaticText model="empire" />
places some text on the page and gives it a URL to go to if selected. The entry in the
asset database will be found under the name Empire. The StaticText transformation
bean will find the asset model under the name empire.
<sasads:Asset id="book" database="Pubcat"
content="55073" type="image" />
<sasads:Image useAsFormElement="false" model="book" />
places an image on the page with no URL to go to if selected. The entry in the asset
database will be found under the content value 55073. The Image transformation bean
will find the asset model under the name book.
These are the same examples with the model nested inside the transformation bean:
<sasads:Image useAsFormElement="false" >
<sasads:Asset elementName="Foundations" database="Pubcat"
type="imagelink" />
<sasads:Image />
<sasads:StaticText >
<sasads:Asset elementName="Empire" database="Pubcat"
type="link" />
<sasads:StaticText />
<sasads:Image useAsFormElement="false" >
<sasads:Asset database="Pubcat" content="55073"
type="image" />
<sasads:Image />
Note that model= is missing from the transformation bean tags and id= is missing from the Asset tags.
The AssetDatabase tag eliminates repetitive references to the asset database name by specifying it once in this tag and then wrapping this tag around Asset tags. This is the same example as the first one, wrapped by an AssetDatabase tag.
<sasads:AssetDatabase database="Pubcat" >
<sasads:Asset id="foundations" elementName="Foundations"
type="imagelink" />
<sasads:Image useAsFormElement="false" model="foundations" />
<sasads:Asset id="empire" elementName="Empire"
type="link" />
<sasads:StaticText model="empire" />
<sasads:Asset id="book" content="55073" type="image"
/>
<sasads:Image useAsFormElement="false" model="book" />
<sasads:AssetDatabase />
Key Classes
com.sas.taglib.assets package:
AssetTag - sets up a model for resources from
the asset database to be used by view custom tags, such as those supported by
transformation beans.AssetDatabase - specifies the name of the
asset database; other custom tags may be nested inside which would inherit the name of the
database.