Documentation for the Utility Tag Library

1. INTRODUCTION

The utility custom tag library contains examples of some basic tags. It illustrates several custom tag library code techniques.

2. PREREQUISITE SOFTWARE

This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1.

3. CONFIGURATION INFORMATION

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/utility" prefix="x" %>
where "x" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

4. TAG DOCUMENTATION

The utility Tag Library contains the following tags:

  1. Hello Tag

    The Hello tag prints out the text "Hello World". It does not have any attributes.

    Attribute
    Description
    Required
    -
    -
    -

  2. Copy Tag

    The MacroCopy tag copies the attribute text to a Writer.

    Attribute
    Description
    Required
    name
    Name associated with the text to be copied. Any string value.
    yes

  3. Paste Tag

    The MacroPaste tag pastes the text specified by a Writer.

    Attribute
    Description
    Required
    name
    Name associated with the text to be pasted. Any string value.
    yes

  4. ShowSource Tag

    The ShowSource tag takes a jspFile and copies the contents to a Writer.

    Attribute
    Description
    Required
    jspFile
    The filename and relative path of the jsp file. Any string value.
    yes

  5. Include Tag

    The Include tag includes in-line the output of the specified url.

    Attribute
    Description
    Required
    url
    Any valid url.
    yes

  6. If Tag

    The If tag is a basic conditional tag.

    Attribute
    Description
    Required
    predicate
    Any string value.
    yes

  7. For Tag

    The For tag is a basic looping tag.

    Attribute
    Description
    Required
    iterations
    Number of loop iterations to be completed. Any string integer value.
    yes
    varName
    Variable name associated with the For loop. Any string value.
    no
    begin
    Loop starting value. Any string integer value.
    no

  8. useBean Tag

    The useBean tag associates an instance of a Java object with the given id.

    Either the classname or type must be specified.

    The beanName and classname attributes are mutually exclusive, you can't specify both.

    Attribute
    Description
    Required
    id
    Uniquely identifies the bean to the JSP container and page. Any string value.
    yes
    scope
    page|request|session|application
    no
    classname
    name of class that defines the implementation of the object.
    no
    type
    type of the scripting variable defined
    no
    beanName
    The name of the bean as expected by the instantiate() method of the java.beans.Beans class
    no
    processRequest
    true|false. JSP 0.92 compatibility.
    no

  9. Validate Tag

    The Validate tag generates Javascript to validate the HTML form.

    Attribute
    Description
    Required
    name
    Name of the form. Any string value.
    yes
    method
    Name of the Javascript function to be generated. Any string value.
    yes
    reqdFields
    Comma separated mandatory field list. Any string value.
    yes