Home

This Chapter
-Chapter 3: The HTML Tag Library
-The html Tag
-The base Tag
-The form Tag
-The text, password, hidden, textarea Tags
-The submit and cancel Tags
-The reset Tag
-The button Tag
-The checkbox Tag
-The multibox Tag
-The radio Tag
-The select Tag
-The option Tag
-The options Tag
-The optionsCollection Tag
-The link Tag
-The img Tag
-The rewrite Tag
-The frame Tag
-The image Tag
-The xhtml Tag
-Summary

Table of Contents
-Introduction
-Chapter 1: Model 2 and Struts
-Chapter 2: Input Validation with Action Forms
-Chapter 3: The HTML Tag Library
-Chapter 4: Input Validation and Data Conversion
-Chapter 5: The Validator Plugin
-Chapter 6: The Expression Language
-Chapter 7: JSTL
-Chapter 8: The Bean Tag Library
-Chapter 9: The Logic Tag Library
-Chapter 10: Struts-EL, Nested, selectLabel
-Chapter 11: Message Handling and Internationalization
-Chapter 12: The Tiles Framework
-Chapter 13: Securing Struts Applications
-Chapter 14: The Config Object
-Chapter 15: The Persistence Layer
-Chapter 16: Object Caching
-Chapter 17: File Upload and File Download
-Chapter 18: Paging and Sorting
-Chapter 19: Preventing Double Submits
-Chapter 20: Early HttpSession Invalidation
-Chapter 21: Decorating Request Objects
-Chapter 22: How Struts Works

Previous
Next

 

The image Tag

The image tag generates an <input type="image"> element. The image tag must be nested inside a form tag. The image tag is similar to the submit tag, but instead of a submit button, you have an image that you can click to submit a form. For example, the displayAddProductForm.jsp page in app03d has the following image tag.

<html:image src="images/submitImage.gif"/>

This is rendered as

<input type="image" name="" src="images/submitImage.gif">

You can click this image to submit the form.

The list of the image tag’s attributes is given in Table 3.17.

Attribute Description Possible Value(s)
indexed A value of true indicates that the enclosing html tag’s name attribute will be indexed, e.g. rendered as propertyName[x]. This attribute only works if nested inside the Logic Tag Library’s iterate tag or a similar tag. false or true.
page The module-relative path of the image for this tag. string
pageKey The key of the message resources string specifying the module-relative path of the image for this tag. string
property The property of the action form mapped to the enclosing form tag that will be associated with the rendered image. string
src The source URL of the image. string
styleClass CSS stylesheet class to be applied to this HTML element (rendered as a class attribute. string
value A constant that will become the value of the rendered input field representing this image. string

Table 3.17: The image tag’s attributes

Previous
Next