This paragraph describes the taglibs that are group under the mwt prefix.
The rescale tag is very important as it enables you to control the behaviour of the Image Server.
As explained in chapter 1, the Image Server automatically rescales all the images from the IMG in your widgets whose width exceeds the current screen width. We have also seen how the HyperText taglib provides a powerful version of the IMG tags that lets you control the image rescaling through the tag's attributes.
But what if you want to force rescaling to a specific width and/or height for all images inside a XHTML block? You normally have two issues to face:
These issues can be solved by using the mwt:rescale tag.
As shown in the following example, this tag is used to instruct the Image Server to rescale all images with an exceeding width that are found in its body.
Example 2.6. Rescaling content from the CMS using the mwt:rescale tag
<div style="padding: 4px; width: ${mwt:width()}px;">
<mwt:rescale width="${mwt:width(-8)}">
<c:out value="${page.post_content}"/>
</mwt:rescale>
</div>
Let's comment the block of taglib code from the example above:
By default the rescale tag only instructs the Image Server to rescale images whose size exceeds the sizes specified in its attributes. It is also possible to force rescale for all images to a specific width and/or height, all you have to do is add a force attribute and set its value to "yes":
This tag is provided to facilitate and automatize the usage of accesskey attribute in document links. In mobile site development the accesskey attribute is a handy way to enhance user experience by providing a mean to create shortcuts to the links of a web page. When using accesskeys the same issues that we have discuss in the previous paragraph arise:
The mwt:accesskey tag comes to rescue us, solving both problems. This bodyless tag has an internal counter, any time a link is found, the accesskey attribute with the value set to the value of the counter is automatically generated inside the "a" tag of the link and the counter value is increased by one. Accesskey generation in the page starts just after the accesskey tag:
Example 2.8. Using mwt:accesskey tag to automatically create button shortcuts for the links in a page
<mwt:accesskey/> ..... <mwt:accesskey set="-1"/>
Accesskey generation stops automatically when the internal counter reachers 9 (all shortcuts have been assigned) or when the tag is used to set a value of -1 for the counter.
In any time you can set the value of the counter by using the set attribute, in this way you can always control and assign a specific accesskey to a link.
By using accessKey API you can, at any time, get the value of the counter. As shown in the example below, you can use the counter value when you want to improve user experience in your pages by displaying the accesskey number in your link text.