Jakarta Project: Input Tag library

Version: 1.0

Table of Contents

Overview

The "input" tag extension library lets you present HTML <form> elements that are tied to the ServletRequest that caused the current JSP page to run. That is, using this library, you can easily prepopulate form elements with prior values that the user has chosen -- or with default values for the first time a user hits a web page. This is useful when you need to present the same page to the user several times (e.g., for server-side validation).

You can also automatically build up <select> boxes, making it easier to build data-driven forms. And even if you don't present the same page multiple times, you may want form elements that have default values; this library lets you do that without writing excessive logic.

What is the "Input" tag library? Read more.

Requirements

This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1 or higher. Plus any requirements for additional API packages.

Configuration

Follow these steps to configure your web application with this tag library:

To use the tags from this library in your JSP pages, add the following directive at the top of each page:

<%@ taglib uri="http://jakarta.apache.org/taglibs/input-1.0" prefix="input" %>

where "input" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

Tag Summary

Input Tags
textDisplays a one-line text-entry box
textareaDisplays a multiline textarea
selectDisplays a select list
radioDisplays a radio button
checkboxDisplays a checkbox
 

Tag Reference

text Availability: 1.0

Displays a one-line text-entry box. See Usage page.

Tag Bodyempty    
Restrictions

None

AttributesNameRequired Runtime Expression Evaluation Availability
 name  Yes   Yes  1.0
 

text box name

 default  No   Yes  1.0
 

text box default value

 attributes  No   Yes  1.0
 

extra text box attributes

VariablesNone
ExamplesNone
textarea Availability: 1.0

Displays a one-line text-entry box. See Usage page.

Tag Bodyempty    
Restrictions

None

AttributesNameRequired Runtime Expression Evaluation Availability
 name  Yes   Yes  1.0
 

textarea name

 default  No   Yes  1.0
 

textarea default value

 attributes  No   Yes  1.0
 

extra textarea attributes

VariablesNone
ExamplesNone
select Availability: 1.0

Displays a select list. See Usage page.

Tag Bodyempty    
Restrictions

None

AttributesNameRequired Runtime Expression Evaluation Availability
 name  Yes   Yes  1.0
 

select name

 default  No   Yes  1.0
 

select default value

 attributes  No   Yes  1.0
 

extra select attributes

 options  Yes   Yes  1.0
 

options list for select

VariablesNone
ExamplesNone
radio Availability: 1.0

Displays a radio button. See Usage page.

Tag Bodyempty    
Restrictions

None

AttributesNameRequired Runtime Expression Evaluation Availability
 name  Yes   Yes  1.0
 

radio button name

 default  No   Yes  1.0
 

radio button default value.

 value  Yes   Yes  1.0
 

value can be empty, but it must be present

 attributes  No   Yes  1.0
 

extra radio button attributes

VariablesNone
ExamplesNone
checkbox Availability: 1.0

Displays a checkbox. See Usage page.

Tag Bodyempty    
Restrictions

None

AttributesNameRequired Runtime Expression Evaluation Availability
 name  Yes   Yes  1.0
 

checkbox name

 default  No   Yes  1.0
 

The two "defaults" for checkbox are concatenated together to form an array of size (defaults.length + 1), or 1 if defaults.length is null or isn't present

 defaults  No   Yes  1.0
 

The two "defaults" for checkbox are concatenated together to form an array of size (defaults.length + 1), or 1 if defaults.length is null or isn't present

 value  Yes   Yes  1.0
 

value can be explicitly empty, or it can be absent, in which case it defaults to "on"

 attributes  No   Yes  1.0
 

extra checkbox attributes

VariablesNone
ExamplesNone

Examples

See the example application input-examples.war for examples of the usage of the tags from this custom tag library.

Java Docs

Java programmers can view the java class documentation for this tag library as javadocs.

Revision History

Review the complete revision history of this tag library.