Struts HTML Tags

The Struts HTML tag library contains tags used to create HTML input forms, as well as other tags generally useful in the creation of HTML-based user interfaces. For example, instead of using a regular HTML text-input field, you can use the text tag from this library.

These tags are designed to work very closely with the other components of the Struts framework, including ActionForms. You always should attempt to use one of these tags first, rather than using standard HTML. These tags’ special knowledge of the rest of the Struts components makes it worthwhile to use them.

Most of the tags within this library must be nested inside of a Struts form tag. There are a few tags included in this library that address issues not necessarily related to forms or form widgets. Those tags also will be discussed briefly in this section. Although not every HTML tag will be discussed, Table 8-1 provides a complete list of the tags that are available in the HTML tag library.

Table 8-1. Custom tags within the Struts HTML tag library

Tag name

Description

base

Renders an HTML base element

button

Renders a button input field

cancel

Renders a cancel button

checkbox

Renders a checkbox input field

errors

Conditionally renders a set of accumulated error messages

file

Renders a file select input field

form

Defines an HTML form element

frame

Renders an HTML frame element

hidden

Renders a hidden field

html

Renders an HTML html element

image

Renders ...

Get Programming Jakarta Struts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.