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 button Tag

This tag generates <input type="button">. You normally use a button to trigger a JavaScript function. The list of attributes for this tag is given in Table 3.8.

Attribute Description Possible Value(s)
property* The property of the action form mapped to the enclosing form tag that will be associated with the rendered HTML button. In practice, this attribute is often assigned an empty string. string
onclick A JavaScript event handler that will be triggered upon the clicking of this button. A JavaScript statement/function

Table 3.8: The button tag’s attributes

For example, the following button tag is used to trigger the checkDate JavaScript function.

<html:button property="aProperty" value="Check Date"
  onclick="checkDate()"/>

If you don’t want to map the button to an action form’s property, as is in most cases, you can assign an empty string to the property attribute.

<html:button property="" value="Do It"/>

Previous
Next