You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by sh...@apache.org on 2001/07/14 18:05:04 UTC

cvs commit: jakarta-taglibs/input/xml intro.xml

shawn       01/07/14 09:05:04

  Modified:    input    README build.xml
               input/examples/web form.jsp
               input/src/org/apache/taglibs/input Checkbox.java Radio.java
                        Select.java Text.java TextArea.java Util.java
               input/xml intro.xml
  Removed:     input    build.bat build.sh
  Log:
  Submitted by: Lance Lavandowska
  Reviewed by: Shawn Bayern
  Changes to (1) comply with XHTML, (2) eliminate pretty-printing for more
  consistent output, (3) update to the new build process.
  
  Revision  Changes    Path
  1.2       +137 -137  jakarta-taglibs/input/README
  
  Index: README
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/README,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- README	2000/08/25 03:19:10	1.1
  +++ README	2001/07/14 16:05:02	1.2
  @@ -1,137 +1,137 @@
  -
  -                            The "Input" Tag Library
  -                                       
  -What is the "Input" tag library?
  -
  -   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.
  -   
  -Rationale
  -
  -   Most web-based, server-side logic is accessed by users of HTML forms.
  -   Since for many applications, input validation is best done on the
  -   server side (for reasons of security, removal of business logic from
  -   the presentation layer, and so on), a typical process of input entry
  -   involves the following cycle (represented as pseudo-code because I'm
  -   in a lazy mood and don't need to describe it better):
  -
  -        browser requests form
  -        do {
  -            web server displays form
  -            user enters information and clicks "submit"
  -            browser POSTs information to web server
  -        } while (server determines that information is incomplete or invalid)
  -        server displays response to successful and complete input
  -
  -   With each presentation of the form, It generally makes sense to
  -   display the user's prior response in order to facilitate the
  -   explanation of why it's invalid. For example, it's considerably more
  -   helpful to a user to show something like:
  -
  -        Problems encountered:
  -        * Invalid email address!
  -          (Email addresses are of the form user@host.domain)
  -        ------------------------------
  -
  -           Name:  Shawn Bayern
  -        ** Email: bayern@incomplete
  -           Sex:   Male
  -           [etc.]
  -
  -   than simply to say "invalid email address" and present an empty spot
  -   on the form next to "Email."
  -   
  -   The problem that authors of systems of this type face is that there's
  -   no strong binding between HTML and data; it's therefore tedious to
  -   construct an HTML form that contains the user's prior response. To
  -   give you an idea, here's a section of HTML and Java from a JSP project
  -   I just finished (quoted approximately):
  -
  -        <select ...>
  -        <% for (int i = 1; i <= x; i++) { %>
  -          <option <%= !firstRunThrough
  -                ? sel(Integer.toString(i), prior)
  -                : sel(i,now.get(default)) %>
  -                ><%= i %></option>
  -        <% } %>
  -        </select>
  -
  -   And it's only that "clean" because I abstracted away two different
  -   sel() functions, one that takes ints and one that takes Strings, both
  -   of which return the String "selected" if their arguments match. These
  -   functions are included at the top of every page that needs them.
  -   
  -   This sort of application cries out for some sort of macro- or
  -   meta-language, and tag libraries for JSP fit in quite nicely. This
  -   sort of problem is a clear-cut case where repetitive work can be cut
  -   down through the use of something that acts as the moral equivalent of
  -   a macro language.
  -   
  -   I've therefore decided to write and provide contribute to the Jakarta
  -   project -- hoping to make web-application developers' lives a little
  -   easier -- a custom tag library called "input" that presents HTML form
  -   elements that are prepopulated with default input. The developer
  -   selects the default input and uses Maps and other objects as necessary
  -   to communicate between the page and the tag library in cases where
  -   input benefits from (to the point where it's almost accurate to say
  -   "requires") something more structured than Strings (which are the
  -   default and usual mediator). The tag library is designed with
  -   ease-of-use and ease of reading code that uses it in mind.
  -   
  -Miscellaneous notes
  -
  -   To make the library more useful, I've taken care to make sure that it
  -   quotes appropriate HTML entities correctly, itself, in attribute
  -   values and textboxes so that users can input characters like & and ",
  -   and your application can do the right thing automatically. You don't
  -   have to worry about whether the user has entered a " in a web form,
  -   which would screw up the HTML you output back to the user unless
  -   handled:
  -
  -        <input type="text" name="blah"
  -            value="you typed a "quoted" string the last time" />
  -
  -   Instead of the tag above, the library will output
  -
  -        <input type="text" name="blah"
  -            value="you typed a &quot;quoted&quot; string the last time" />
  -
  -   This library differs from similar ones in a number of ways. It
  -   attempts to be more general than the similar tags that JRun's tag
  -   library supports; this one is open-source, first of all, which I don't
  -   believe JRun's is, and it isn't tied to HTML 4.0 attributes. Since you
  -   pass in an "attributes" map, you can include whatever attribute/value
  -   pairs you'd like.
  -   
  -   Joseph Ottinger's [1]Form Taglib is thorough and reasonably similar to
  -   mine in terms of what it can do. I've optimized mine for a special
  -   case -- tying data to the ServletRequest object -- and tried to make
  -   it particularly easy to use regardless of how your application
  -   structures its data. That is, you don't have to use JavaBeans or
  -   create any new classes at all to use this library. You might find that
  -   Ottinger's fits your needs better or works more generally with your
  -   data, and his library provides support for building up an entire <form>,
  -   JavaScript validation, and so on -- stuff I've stayed away from for
  -   reasons entirely related to personal opinions and nothing more. (I
  -   personally use server-side validation more than client-side validation
  -   for just about everything.) His library seems great, overall; pick
  -   whichever one seems to make your life easier at the time you're
  -   deciding.
  -   
  -   
  -    Shawn Bayern
  -    shawn.bayern@oooo.com
  -
  -References
  -
  -   1. http://cupid.suninternet.com/~joeo/?key=form
  +
  +                            The "Input" Tag Library
  +                                       
  +What is the "Input" tag library?
  +
  +   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.
  +   
  +Rationale
  +
  +   Most web-based, server-side logic is accessed by users of HTML forms.
  +   Since for many applications, input validation is best done on the
  +   server side (for reasons of security, removal of business logic from
  +   the presentation layer, and so on), a typical process of input entry
  +   involves the following cycle (represented as pseudo-code because I'm
  +   in a lazy mood and don't need to describe it better):
  +
  +        browser requests form
  +        do {
  +            web server displays form
  +            user enters information and clicks "submit"
  +            browser POSTs information to web server
  +        } while (server determines that information is incomplete or invalid)
  +        server displays response to successful and complete input
  +
  +   With each presentation of the form, It generally makes sense to
  +   display the user's prior response in order to facilitate the
  +   explanation of why it's invalid. For example, it's considerably more
  +   helpful to a user to show something like:
  +
  +        Problems encountered:
  +        * Invalid email address!
  +          (Email addresses are of the form user@host.domain)
  +        ------------------------------
  +
  +           Name:  Shawn Bayern
  +        ** Email: bayern@incomplete
  +           Sex:   Male
  +           [etc.]
  +
  +   than simply to say "invalid email address" and present an empty spot
  +   on the form next to "Email."
  +   
  +   The problem that authors of systems of this type face is that there's
  +   no strong binding between HTML and data; it's therefore tedious to
  +   construct an HTML form that contains the user's prior response. To
  +   give you an idea, here's a section of HTML and Java from a JSP project
  +   I just finished (quoted approximately):
  +
  +        <select ...>
  +        <% for (int i = 1; i <= x; i++) { %>
  +          <option <%= !firstRunThrough
  +                ? sel(Integer.toString(i), prior)
  +                : sel(i,now.get(default)) %>
  +                ><%= i %></option>
  +        <% } %>
  +        </select>
  +
  +   And it's only that "clean" because I abstracted away two different
  +   sel() functions, one that takes ints and one that takes Strings, both
  +   of which return the String "selected" if their arguments match. These
  +   functions are included at the top of every page that needs them.
  +   
  +   This sort of application cries out for some sort of macro- or
  +   meta-language, and tag libraries for JSP fit in quite nicely. This
  +   sort of problem is a clear-cut case where repetitive work can be cut
  +   down through the use of something that acts as the moral equivalent of
  +   a macro language.
  +   
  +   I've therefore decided to write and provide contribute to the Jakarta
  +   project -- hoping to make web-application developers' lives a little
  +   easier -- a custom tag library called "input" that presents HTML form
  +   elements that are prepopulated with default input. The developer
  +   selects the default input and uses Maps and other objects as necessary
  +   to communicate between the page and the tag library in cases where
  +   input benefits from (to the point where it's almost accurate to say
  +   "requires") something more structured than Strings (which are the
  +   default and usual mediator). The tag library is designed with
  +   ease-of-use and ease of reading code that uses it in mind.
  +   
  +Miscellaneous notes
  +
  +   To make the library more useful, I've taken care to make sure that it
  +   quotes appropriate HTML entities correctly, itself, in attribute
  +   values and textboxes so that users can input characters like & and ",
  +   and your application can do the right thing automatically. You don't
  +   have to worry about whether the user has entered a " in a web form,
  +   which would screw up the HTML you output back to the user unless
  +   handled:
  +
  +        <input type="text" name="blah"
  +            value="you typed a "quoted" string the last time" />
  +
  +   Instead of the tag above, the library will output
  +
  +        <input type="text" name="blah"
  +            value="you typed a &quot;quoted&quot; string the last time" />
  +
  +   This library differs from similar ones in a number of ways. It
  +   attempts to be more general than the similar tags that JRun's tag
  +   library supports; this one is open-source, first of all, which I don't
  +   believe JRun's is, and it isn't tied to HTML 4.0 attributes. Since you
  +   pass in an "attributes" map, you can include whatever attribute/value
  +   pairs you'd like.
  +   
  +   Joseph Ottinger's [1]Form Taglib is thorough and reasonably similar to
  +   mine in terms of what it can do. I've optimized mine for a special
  +   case -- tying data to the ServletRequest object -- and tried to make
  +   it particularly easy to use regardless of how your application
  +   structures its data. That is, you don't have to use JavaBeans or
  +   create any new classes at all to use this library. You might find that
  +   Ottinger's fits your needs better or works more generally with your
  +   data, and his library provides support for building up an entire <form>,
  +   JavaScript validation, and so on -- stuff I've stayed away from for
  +   reasons entirely related to personal opinions and nothing more. (I
  +   personally use server-side validation more than client-side validation
  +   for just about everything.) His library seems great, overall; pick
  +   whichever one seems to make your life easier at the time you're
  +   deciding.
  +   
  +   
  +    Shawn Bayern
  +    shawn.bayern@oooo.com
  +
  +References
  +
  +   1. http://adjacency.org/formtags.jsp
  
  
  
  1.8       +55 -206   jakarta-taglibs/input/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/build.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build.xml	2001/07/01 20:08:23	1.7
  +++ build.xml	2001/07/14 16:05:02	1.8
  @@ -1,206 +1,55 @@
  -<!-- ANT Build Script for the "input" Custom Tag Library -->
  -<project name="jspspec" default="main" basedir=".">
  -
  -    <!-- ******************** Adjustable Properties *********************** -->
  -
  -    <!--
  -
  -        The following property values should be examined and customized
  -	for each custom tag library subproject.
  -
  -	ant.home                    Home directory for the ANT build tool
  -	                            This is normally defaulted from the
  -				    ANT_HOME environment variable in the
  -				    build script.
  -
  -	servlet.jar                 Pathname of the servlet API classes
  -	                            you are using to compile, such as the
  -				    one that comes with Tomcat.  This is
  -				    normally defaulted from the SERVLET_JAR
  -				    environment variable in the build script.
  -
  -        taglib.name		    Base name of this tag library subproject.
  -
  -    -->
  -
  -    <property name="taglib.name"    value="input"/>
  -    <property name="servlet.jar"    value="../../jakarta-servletapi/lib/servlet.jar"/>
  -
  -    <!-- ****************** Project Standard Properties ******************* -->
  -
  -    <!--
  -
  -        The following property values reflect the standard directory
  -	organization for the jakarta-taglibs project, and should not
  -	be changed or overridden.
  -
  -	build.dir                   Base directory for build targets
  -	dist.dir                    Base directory for distribution targets
  -        taglibs.xsl                 Taglibs stylesheet
  -
  -    -->
  -
  -    <property name="build.dir"      value="../build"/>
  -    <property name="dist.dir"       value="../dist"/>
  -    <property name="taglibs.xsl"    value="../src/doc/stylesheets/taglibs.xsl"/>
  -
  -    <!-- *********************** Default Properties ********************** -->
  -
  -    <!--
  -
  -        The following property values reflect the recommended directory
  -	structure for each custom tag library subproject.  You should only
  -	need to adjust or override them if you use a different organization.
  -
  -	conf.src                    Library configuration source directory
  -        doc.src                     Documentation app source directory
  -        examples.src                Examples app source directory
  -        library.src                 Library Java source directory
  -
  -    -->
  -
  -    <property name="conf.src"       value="conf"/>
  -    <property name="doc.src"        value="doc"/>
  -    <property name="examples.src"   value="examples"/>
  -    <property name="library.src"    value="src"/>
  -
  -
  -    <!-- ********************* Derived Properties ************************* -->
  -
  -    <!--
  -
  -        These property values are derived from the previously defined values,
  -	and should not normally be overridden from the command line.
  -
  -        build.doc                   Target directory for documentation app
  -        build.examples		    Target directory for examples app
  -        build.library               Target directory for tag library
  -	dist.doc                    Destination WAR for documentation app
  -	dist.examples		    Destination WAR for examples app
  -	dist.library                Destination JAR for tag library
  -	dist.tld                    Destination TLD file for tag library
  -
  -    -->
  -
  -    <property name="build.doc"      value="${build.dir}/${taglib.name}/${taglib.name}-doc"/>
  -    <property name="build.examples" value="${build.dir}/${taglib.name}/${taglib.name}-examples"/>
  -    <property name="build.library"  value="${build.dir}/${taglib.name}/${taglib.name}"/>
  -    <property name="dist.doc"       value="${dist.dir}/${taglib.name}/${taglib.name}-doc.war"/>
  -    <property name="dist.examples"  value="${dist.dir}/${taglib.name}/${taglib.name}-examples.war"/>
  -    <property name="dist.library"   value="${dist.dir}/${taglib.name}/${taglib.name}.jar"/>
  -    <property name="dist.tld"       value="${dist.dir}/${taglib.name}/${taglib.name}.tld"/>
  -    <property name="taglibs.doc"    value="${dist.dir}/doc/doc/${taglib.name}-doc"/>
  -
  -
  -  <!-- ********************** Destination Preparation ********************* -->
  -
  -  <target name="prepare">
  -    <!-- Set up build directories -->
  -    <mkdir dir="${build.dir}"/>
  -    <mkdir dir="${build.doc}"/>
  -    <mkdir dir="${build.doc}/WEB-INF"/>
  -    <mkdir dir="${build.doc}/WEB-INF/classes"/>
  -    <mkdir dir="${build.doc}/WEB-INF/lib"/>
  -    <mkdir dir="${build.examples}"/>
  -    <mkdir dir="${build.examples}/WEB-INF"/>
  -    <mkdir dir="${build.examples}/WEB-INF/classes"/>
  -    <mkdir dir="${build.examples}/WEB-INF/lib"/>
  -    <mkdir dir="${build.library}"/>
  -    <mkdir dir="${build.library}/META-INF"/>
  -    <!-- Set up distribution directory -->
  -    <mkdir dir="${dist.dir}"/>
  -    <mkdir dir="${dist.dir}/${taglib.name}"/>
  -  </target>
  -
  -
  -  <!-- **************** Compile Tag Library Components ******************** -->
  -
  -  <!-- Compile the documentation application -->
  -  <target name="documentation" depends="prepare">
  -    <copy todir="${build.doc}/WEB-INF">
  -      <fileset dir="${doc.src}/conf"/>
  -    </copy>
  -    <!-- intro.xml isn't part of the documentation application,
  -         this is just a handy place to build it for the web site. -->
  -    <style in="xml/intro.xml"
  -           destdir="${build.doc}"
  -           out="${build.doc}/intro.html"
  -           style="${taglibs.xsl}">
  -      <param name="prefix" expression="../../"/>
  -    </style>
  -    <copy todir="${build.doc}">
  -      <fileset dir="${doc.src}/web">
  -        <include name="**/*.html"/>
  -      </fileset>
  -    </copy>
  -  </target>
  -
  -  <!-- Compile the examples application -->
  -  <target name="examples" depends="library-dist">
  -    <copy todir="${build.examples}/WEB-INF">
  -      <fileset dir="${examples.src}/conf"/>
  -    </copy>
  -    <copy todir="${build.examples}">
  -      <fileset dir="${examples.src}/web"/>
  -    </copy>
  -    <copy file="${dist.tld}"
  -              tofile="${build.examples}/WEB-INF/${taglib.name}.tld"/>
  -    <copy file="${dist.library}"
  -              tofile="${build.examples}/WEB-INF/lib/${taglib.name}.jar"/>
  -   <!--
  -    <javac srcdir="${examples.src}/src"
  -           destdir="${build.examples}/WEB-INF/classes"
  -           classpath="${servlet.jar}" debug="on"/>
  -     -->
  -  </target>
  -
  -  <!-- Compile the tag library itself -->
  -  <target name="library" depends="prepare">
  -    <copy file="${conf.src}/taglib.tld"
  -              tofile="${build.library}/META-INF/taglib.tld"/>
  -    <javac srcdir="${library.src}" destdir="${build.library}"
  -           classpath="${servlet.jar}" debug="on"/>
  -  </target>
  -
  -  <!-- Compile the library as well as the associated applications -->
  -  <target name="main" depends="library,documentation,examples"/>
  -
  -
  -  <!-- ******************* Create Distribution Files ********************** -->
  -
  -  <!-- Create the documentation application WAR file -->
  -  <target name="documentation-dist" depends="documentation">
  -    <jar jarfile="${dist.doc}" basedir="${build.doc}" excludes="intro.html"/>
  -    <mkdir dir="${taglibs.doc}"/>
  -    <copy todir="${taglibs.doc}">
  -      <fileset dir="${build.doc}">
  -        <exclude name="WEB-INF"/>     
  -      </fileset>
  -    </copy>
  -  </target>
  -
  -  <!-- Create the examples application WAR file -->
  -  <target name="examples-dist" depends="examples">
  -    <jar jarfile="${dist.examples}" basedir="${build.examples}"/>
  -  </target>
  -
  -  <!-- Create the library distribution files -->
  -  <target name="library-dist" depends="library">
  -    <jar jarfile="${dist.library}" basedir="${build.library}"/>
  -    <copy file="${conf.src}/taglib.tld" tofile="${dist.tld}"/>
  -  </target>
  -
  -  <!-- Create the entire set of distribution files -->
  -  <target name="dist" depends="library-dist,examples-dist,documentation-dist"/>
  -
  -
  -
  -  <!-- ************************ Utility Commands ************************** -->
  -
  -  <!-- Delete output directories and files so we can build from scratch -->
  -  <target name="clean">
  -    <delete dir="${build.dir}/${taglib.name}"/>
  -    <delete dir="${dist.dir}/${taglib.name}"/>
  -  </target>
  -
  -</project>
  +<?xml version="1.0"?>
  +
  +
  +<!-- Define and use the common.xml ant build file for building
  +     your taglib -->
  +
  +<!DOCTYPE project [
  +    <!ENTITY common SYSTEM "file:../common.xml">
  +]>
  +
  +<!-- Your main ant build declaration -->
  +
  +<project name="input" default="main">
  +
  +    <property name="gen-docs.present" value="true"/>
  +    
  +  <!-- By default, common.xml adds servlet.jar to the classpath
  +       ant uses when building your taglib.  If you need to use
  +       additional jar files or this is a JSP1.2 taglib you will
  +       have to override the ant definition of the classpath by
  +       uncommenting the below declarations and adding any required
  +       jar files to the ant classpath. -->
  +
  +  <!-- Load in your local build properties which define jar
  +       file locations.
  +  <property file="../build.properties"/> -->
  +  <!-- Define additional jar files to be used by ant when
  +       building your taglib.  The classpath value is a ":"
  +       separated list of jar file property names from your
  +       local build.properties file. Use servlet23.jar instead
  +       of servlet.jar if this is a JSP1.2 taglib.
  +  <property name="classpath" value="${servlet.jar}:${jakarta-oro.jar}"/> -->
  +  <!-- Define the property jsp12.present if this is a JSP 1.2 taglib
  +  <property name="jsp12.present" value="true"/> -->
  +
  +  <!-- common.xml defines a number of targets in its build process
  +       which you can override in your local build.xml file.  In this
  +       case we want to override the ant target "checkRequirements.pre"
  +       so that we can verify that the required jar files are present.
  +  <property name="checkRequirements.pre" value="checkRequirements.pre"/> -->
  +
  +
  +  <!-- Here is the ant target that overrides "checkRequirements.pre"
  +  <target name="checkRequirements.pre">
  +    <antcall target="checkRequiredFile">
  +       <param name="file" value="${jakarta-oro.jar}"/>
  +       <param name="fail.message" value="a jar file containing the jakarta-oro-2 classes is required to compile the regexp taglib. please define the property jakarta-oro-2.jar in your jakarta.properties file and ensure that the file exists"/>
  +    </antcall>
  +  </target> -->
  +
  +  <!-- Include the common.xml ant build declarations -->
  +  &common;
  +
  +</project>
  +
  
  
  
  1.2       +29 -21    jakarta-taglibs/input/examples/web/form.jsp
  
  Index: form.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/examples/web/form.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- form.jsp	2000/08/25 03:26:19	1.1
  +++ form.jsp	2001/07/14 16:05:03	1.2
  @@ -2,6 +2,7 @@
   <!--
     Copyright (c) 2000 The Apache Software Foundation.  All rights reserved.
     Author: Shawn Bayern (shawn.bayern@oooo.com).
  +  Author: Lance Lavandowska (lance@brainopolis.com).
   
     This is a simple test of the "input" taglib.  The <form> defaults to
     GETting back to itself, which is convenient since you can see the
  @@ -14,24 +15,27 @@
   <%@ taglib uri="http://jakarta.apache.org/taglibs/input-0.90" prefix="input" %>
   <p>
   
  -<% java.util.Hashtable h = new java.util.Hashtable(); %>
  -<% h.put("foo", "bar"); %>
  -<% h.put("whee", "ding"); %>
  -<% h.put("empty", ""); %>
  +<% 
  +java.util.Hashtable h = new java.util.Hashtable();
  +h.put("foo", "bar");
  +h.put("whee", "ding");
  +h.put("empty", ""); 
  +%>
   
   <form>
   <p>
  +Username:  <input:text name="username" attributes="<%= h %>" default="shawn" /><br />
  +Full Name: <input:text name="fullname" default="Shawn Bayern" />
   
  -Username:   <input:text name="username" attributes="<%= h %>" default="shawn" />
   
   <br />
   <br />
   
   Statement of purpose:
  -	<input:textarea 
  -		name="purpose"
  -		attributes="<%= h %>"
  -		default="none at this time" />
  +    <input:textarea 
  +        name="purpose"
  +        attributes="<%= h %>"
  +        default="none at this time" />
   
   <br />
   <br />
  @@ -41,16 +45,18 @@
   <br />
   <br />
   
  -<% java.util.HashMap a = new java.util.HashMap(); %>
  -<% // a.put("multiple", null); %>
  +<% 
  +java.util.HashMap a = new java.util.HashMap();
  +// a.put("multiple", null);
  +
  +java.util.Hashtable o = new java.util.Hashtable();
  +o.put("one", "1");
  +o.put("two", "2");
  +o.put("three", "3"); 
  +%>
  +<input:select name="choice" default="2" 
  +    attributes="<%= a %>" options="<%= o %>" />
   
  -<% java.util.Hashtable o = new java.util.Hashtable(); %>
  -<% o.put("one", "1"); %>
  -<% o.put("two", "2"); %>
  -<% o.put("three", "3"); %>
  -<input:select name="choice"
  -	 default="4" attributes="<%= a %>" options="<%= o %>" />
  -
   <br />
   <br />
   
  @@ -69,9 +75,11 @@
   <br />
   <br />
   
  -<% String[] defaults = new String[2]; %>
  -<% defaults[0] = "2"; %>
  -<% defaults[1] = "5"; %>
  +<% 
  +String[] defaults = new String[2];
  +defaults[0] = "2";
  +defaults[1] = "5";
  +%>
   
   Numbers you don't mind: &nbsp;&nbsp;&nbsp
   <input:checkbox name="checkbox" value="1" defaults="<%= defaults %>"/>1
  
  
  
  1.3       +79 -80    jakarta-taglibs/input/src/org/apache/taglibs/input/Checkbox.java
  
  Index: Checkbox.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/src/org/apache/taglibs/input/Checkbox.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Checkbox.java	2001/05/12 01:42:05	1.2
  +++ Checkbox.java	2001/07/14 16:05:03	1.3
  @@ -68,30 +68,31 @@
    *
    *  @version 0.90
    *  @author Shawn Bayern
  + *  @author Lance Lavandowska
    */
   
   public class Checkbox extends TagSupport {
   
  -    private String name;		// name of the checkbox group
  -    private String value;		// value of this particular button
  -    private String dVal;		// our single default value
  -    private String[] dValArray;		// our multiple default values
  -    private Map attributes;		// attributes of the <input> element
  +    private String name;        // name of the checkbox group
  +    private String value;       // value of this particular button
  +    private String dVal;        // our single default value
  +    private String[] dValArray;     // our multiple default values
  +    private Map attributes;     // attributes of the <input> element
   
       public void setName(String x) {
  -	name = x;
  +        name = x;
       }
   
       public void setValue(String x) {
  -	value = x;
  +        value = x;
       }
   
       public void setAttributes(Map x) {
  -	attributes = x;
  +        attributes = x;
       }
   
       public void setDefault(String x) {
  -	dVal = x;
  +        dVal = x;
       }
   
       public void setDefaults(String[] x) {
  @@ -99,80 +100,78 @@
       }
   
       public int doStartTag() throws JspException {
  -	try {
  +        try {
               // sanity check
               if (name == null || name.equals(""))
                   throw new JspTagException("invalid null or empty 'name'");
   
  -	    // replace null value with "on"
  -	    if (value == null)
  -		value = "on";
  -
  -	    // get what we need from the page
  -	    ServletRequest req = pageContext.getRequest();
  -	    JspWriter out = pageContext.getOut();
  -
  -	    // construct a vector of default values
  -	    Vector dVals = new Vector();
  -	    if (dVal != null)
  -		dVals.add(dVal);
  -	    if (dValArray != null)
  -		for (int i = 0; i < dValArray.length; i++)
  -		    if (dValArray[i] != null)
  -			dVals.add(dValArray[i]);
  -
  -	    // start building up the tag
  -	    out.println();
  -	    out.println("<input ");
  -	    out.println("    type=\"checkbox\"");
  -	    out.println("    name=\"" + Util.quote(name) + "\"");
  -	    out.println("    value=\"" + Util.quote(value) + "\"");
  -
  -	    // include any attributes we've got here
  -	    Util.printAttributes(out, attributes);
  -
  -	    /*
  -	     * Check this box (no pun intended) against potentially multiple
  -	     * selections.  (No need for a hash table as in <select> because
  -	     * we're doing this exactly once per tag.  We COULD cache stuff
  -	     * between tags, but I'm not sure that kind of extra performance
  -	     * would ever be called for.)  Note that we only use the
  -	     * "defaults" if the request is ENTIRELY empty; this is different
  -	     * from what we do with the other input types, checking "defaults"
  -	     * when there's no value for the specific field.  This difference
  -	     * is the result of the underlying inconsistency between checkboxes
  -	     * and everything else.
  -	     */
  -	    String[] checked = req.getParameterValues(name);
  -	    if (!req.getParameterNames().hasMoreElements()) {
  -		// use "default" array if we got nothing from the request
  -		if (dVals != null)
  -		    for (int i = 0; i < dVals.size(); i++) {
  -			if (dVals.get(i) == null
  -				|| !(dVals.get(i) instanceof String))
  -			    throw new JspTagException(
  -				"'default' array must only contain non-null "
  -				+ "Strings");
  -			if (((String) dVals.get(i)).equals(value)) {
  -			    out.println("    checked");
  -			    break;				// why go on?
  -			}
  -		    }
  -	    } else if (checked != null) {
  -		// use the request if it says anything
  -		for (int i = 0; i < checked.length; i++)
  -		    if (checked[i].equals(value)) {
  -			out.println("    checked");
  -			break;					// why go on?
  -		    }
  -	    }
  -
  -	    // end the tag
  -	    out.println("/>");
  -
  -	} catch (Exception ex) {
  -	    throw new JspTagException(ex.getMessage());
  -	}
  -	return SKIP_BODY;
  +            // replace null value with "on"
  +            if (value == null)
  +                value = "on";
  +
  +            // get what we need from the page
  +            ServletRequest req = pageContext.getRequest();
  +            JspWriter out = pageContext.getOut();
  +
  +            // construct a vector of default values
  +            Vector dVals = new Vector();
  +            if (dVal != null)
  +                dVals.add(dVal);
  +            if (dValArray != null)
  +                for (int i = 0; i < dValArray.length; i++)
  +                    if (dValArray[i] != null)
  +                        dVals.add(dValArray[i]);
  +
  +            // start building up the tag
  +            out.print("<input type=\"checkbox\" ");
  +            out.print("name=\"" + Util.quote(name) + "\" ");
  +            out.print("value=\"" + Util.quote(value) + "\" ");
  +
  +            // include any attributes we've got here
  +            Util.printAttributes(out, attributes);
  +
  +          /*
  +           * Check this box (no pun intended) against potentially multiple
  +           * selections.  (No need for a hash table as in <select> because
  +           * we're doing this exactly once per tag.  We COULD cache stuff
  +           * between tags, but I'm not sure that kind of extra performance
  +           * would ever be called for.)  Note that we only use the
  +           * "defaults" if the request is ENTIRELY empty; this is different
  +           * from what we do with the other input types, checking "defaults"
  +           * when there's no value for the specific field.  This difference
  +           * is the result of the underlying inconsistency between checkboxes
  +           * and everything else.
  +           */
  +          String[] checked = req.getParameterValues(name);
  +          if (!req.getParameterNames().hasMoreElements()) {
  +              // use "default" array if we got nothing from the request
  +              if (dVals != null)
  +                  for (int i = 0; i < dVals.size(); i++) {
  +                      if (dVals.get(i) == null
  +                              || !(dVals.get(i) instanceof String))
  +                          throw new JspTagException(
  +                              "'default' array must only contain non-null "
  +                              + "Strings");
  +                      if (((String) dVals.get(i)).equals(value)) {
  +                          out.print("checked=\"checked\" ");
  +                          break;              // why go on?
  +                      }
  +                  }
  +          } else if (checked != null) {
  +              // use the request if it says anything
  +              for (int i = 0; i < checked.length; i++)
  +                  if (checked[i].equals(value)) {
  +                      out.print("checked=\"checked\" ");
  +                      break;                  // why go on?
  +                  }
  +          }
  +
  +          // end the tag
  +          out.print("/>");
  +
  +      } catch (Exception ex) {
  +          throw new JspTagException(ex.getMessage());
  +      }
  +      return SKIP_BODY;
       }
   }
  
  
  
  1.2       +40 -41    jakarta-taglibs/input/src/org/apache/taglibs/input/Radio.java
  
  Index: Radio.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/src/org/apache/taglibs/input/Radio.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Radio.java	2000/08/25 03:26:19	1.1
  +++ Radio.java	2001/07/14 16:05:03	1.2
  @@ -68,68 +68,67 @@
    *
    *  @version 0.90
    *  @author Shawn Bayern
  + *  @author Lance Lavandowska
    */
   
   public class Radio extends TagSupport {
   
  -    private String name;		// name of the radio-button group
  -    private String value;		// value of this particular button
  -    private String dVal;		// default value if none is found
  -    private Map attributes;		// attributes of the <input> element
  +    private String name;        // name of the radio-button group
  +    private String value;       // value of this particular button
  +    private String dVal;        // default value if none is found
  +    private Map attributes;     // attributes of the <input> element
   
       public void setName(String x) {
  -	name = x;
  +        name = x;
       }
   
       public void setValue(String x) {
  -	value = x;
  +        value = x;
       }
   
       public void setAttributes(Map x) {
  -	attributes = x;
  +        attributes = x;
       }
   
       public void setDefault(String x) {
  -	dVal = x;
  +        dVal = x;
       }
   
       public int doStartTag() throws JspException {
  -	try {
  +        try {
               // sanity check (but value CAN be empty)
               if (name == null || name.equals("") || value == null)
                   throw new JspTagException(
  -		    "invalid null or empty 'name' or 'value'");
  +                    "invalid null or empty 'name' or 'value'");
   
  -	    // get what we need from the page
  -	    ServletRequest req = pageContext.getRequest();
  -	    JspWriter out = pageContext.getOut();
  -
  -	    // start building up the tag
  -	    out.println();
  -	    out.println("<input ");
  -	    out.println("    type=\"radio\"");
  -	    out.println("    name=\"" + Util.quote(name) + "\"");
  -	    out.println("    value=\"" + Util.quote(value) + "\"");
  -
  -	    // include any attributes we've got here
  -	    Util.printAttributes(out, attributes);
  -
  -	    // check this button if it's the right one
  -	    String target;
  -	    if (req.getParameter(name) == null)
  -		target = dVal;
  -	    else
  -		target = req.getParameter(name);
  -
  -	    if (target != null && target.equals(value))
  -		out.println("    checked");
  -
  -	    // end the tag
  -	    out.println("/>");
  -
  -	} catch (Exception ex) {
  -	    throw new JspTagException(ex.getMessage());
  -	}
  -	return SKIP_BODY;
  +            // get what we need from the page
  +            ServletRequest req = pageContext.getRequest();
  +            JspWriter out = pageContext.getOut();
  +
  +            // start building up the tag
  +            out.print("<input type=\"radio\" ");
  +            out.print("name=\"" + Util.quote(name) + "\" ");
  +            out.print("value=\"" + Util.quote(value) + "\" ");
  +
  +            // include any attributes we've got here
  +            Util.printAttributes(out, attributes);
  +
  +            // check this button if it's the right one
  +            String target;
  +            if (req.getParameter(name) == null)
  +                target = dVal;
  +            else
  +                target = req.getParameter(name);
  +
  +            if (target != null && target.equals(value))
  +                out.print("checked=\"checked\" ");
  +
  +            // end the tag
  +            out.print("/>");
  +
  +        } catch (Exception ex) {
  +            throw new JspTagException(ex.getMessage());
  +        }
  +        return SKIP_BODY;
       }
   }
  
  
  
  1.2       +96 -97    jakarta-taglibs/input/src/org/apache/taglibs/input/Select.java
  
  Index: Select.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/src/org/apache/taglibs/input/Select.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Select.java	2000/08/25 03:26:19	1.1
  +++ Select.java	2001/07/14 16:05:03	1.2
  @@ -68,120 +68,119 @@
    *
    *  @version 0.90
    *  @author Shawn Bayern
  + *  @author Lance Lavandowska
    */
   
   public class Select extends TagSupport {
   
  -    private String name;		// name of the select element
  -    private String dVal;		// default value if none is found
  -    private Map attributes;		// attributes of the <select> element
  -    private Map options;		// what are our options? :)
  +    private String name;        // name of the select element
  +    private String dVal;        // default value if none is found
  +    private Map attributes;     // attributes of the <select> element
  +    private Map options;        // what are our options? :)
   
       public void setName(String x) {
  -	name = x;
  +        name = x;
       }
   
       public void setAttributes(Map x) {
  -	attributes = x;
  +        attributes = x;
       }
   
       public void setDefault(String x) {
  -	dVal = x;
  +        dVal = x;
       }
   
       public void setOptions(Map x) {
  -	options = x;
  +        options = x;
       }
   
       public int doStartTag() throws JspException {
  -	try {
  -	    // sanity check
  -	    if (name == null || name.equals(""))
  -		throw new JspTagException("invalid null or empty 'name'");
  -
  -	    // get what we need from the page
  -	    ServletRequest req = pageContext.getRequest();
  -	    JspWriter out = pageContext.getOut();
  -
  -	    // start building up the tag
  -	    out.println();
  -	    out.println("<select ");
  -	    out.println("    name=\"" + Util.quote(name) + "\"");
  -
  -	    // include any attributes we've got here
  -	    Util.printAttributes(out, attributes);
  -
  -	    // end the starting tag
  -	    out.println(">");
  -
  -	    /*
  -	     * Print out our options, selecting one or more if appropriate.
  -	     * If there are multiple selections but the page doesn't call
  -	     * for a <select> that accepts them, ignore the selections.
  -	     * This is preferable to throwing a JspException because the
  -	     * (end) user can control input, and we don't want the user
  -	     * causing exceptions in our application.
  -	     */
  -
  -	    // get the current selection
  -	    String[] selected = req.getParameterValues(name);
  -	    if (selected != null && selected.length > 1 &&
  -		    (attributes == null || 
  -			!attributes.containsKey("multiple")))
  -		selected = null;
  -
  -	    // load up the selected values into a hash table for faster access
  -	    HashMap chosen = new HashMap();
  -	    if (selected != null)
  -		for (int i = 0; i < selected.length; i++)
  -		    chosen.put(selected[i], null);
  -
  -	    // actually print the <option> tags
  -	    if (options != null) {
  -		Iterator i = options.keySet().iterator();
  -		while (i.hasNext()) {
  -		    Object oKey = i.next();
  -		    Object oVal = options.get(oKey);
  -
  -		    /* If the option contains non-Strings, give the user
  -		     * a more meaningful message than what he or she would get
  -		     * if we just propagated a ClassCastException back.
  -		     * (This'll get caught below).
  -		     */
  -		    if (!(oKey instanceof String) ||
  -			    (oVal != null && !(oVal instanceof String)))
  -			throw new JspException(
  -			    "all members in options Map must be Strings");
  -		    String key = (String) oKey;
  -		    String value = (String) oVal;
  -		    if (value == null)
  -			value = key;		// use key if value is null
  -
  -		    out.print("<option");
  -		    if (!value.equals(key))
  -			out.print(" value=\"" + Util.quote(value) + "\"");
  -		    /*
  -		     * This may look confusing: we match the VALUE of
  -		     * this option pair with the KEY of the 'chosen' Map
  -		     * (We want to match <option>s on values, not keys.)
  -		     */
  -		    if ((selected != null && chosen.containsKey(value))
  -			    || (selected == null && dVal != null &&
  -				value.equals(dVal)))
  -			out.print(" selected");
  -		    out.print(">");
  -		    out.print(Util.quote(key));
  -		    out.println("</option>");
  -		}
  -	    } else
  -		throw new JspTagException("invalid select: no options");
  -
  -	    // close off the surrounding select
  -	    out.println("</select>");
  -
  -	} catch (Exception ex) {
  -	    throw new JspTagException(ex.getMessage());
  -	}
  -	return SKIP_BODY;
  +        try {
  +            // sanity check
  +            if (name == null || name.equals(""))
  +                throw new JspTagException("invalid null or empty 'name'");
  +
  +            // get what we need from the page
  +            ServletRequest req = pageContext.getRequest();
  +            JspWriter out = pageContext.getOut();
  +
  +            // start building up the tag
  +            out.print("<select name=\"" + Util.quote(name) + "\" ");
  +
  +            // include any attributes we've got here
  +            Util.printAttributes(out, attributes);
  +
  +            // end the starting tag
  +            out.println(">");
  +
  +            /*
  +             * Print out our options, selecting one or more if appropriate.
  +             * If there are multiple selections but the page doesn't call
  +             * for a <select> that accepts them, ignore the selections.
  +             * This is preferable to throwing a JspException because the
  +             * (end) user can control input, and we don't want the user
  +             * causing exceptions in our application.
  +             */
  +
  +            // get the current selection
  +            String[] selected = req.getParameterValues(name);
  +            if (selected != null && selected.length > 1 &&
  +                    (attributes == null || 
  +                    !attributes.containsKey("multiple")))
  +                selected = null;
  +
  +            // load up the selected values into a hash table for faster access
  +            HashMap chosen = new HashMap();
  +            if (selected != null)
  +                for (int i = 0; i < selected.length; i++)
  +                    chosen.put(selected[i], null);
  +
  +            // actually print the <option> tags
  +            if (options != null) {
  +                Iterator i = options.keySet().iterator();
  +                while (i.hasNext()) {
  +                    Object oKey = i.next();
  +                    Object oVal = options.get(oKey);
  +
  +                    /* If the option contains non-Strings, give the user
  +                     * a more meaningful message than what he or she would get
  +                     * if we just propagated a ClassCastException back.
  +                     * (This'll get caught below).
  +                     */
  +                    if (!(oKey instanceof String) ||
  +                            (oVal != null && !(oVal instanceof String)))
  +                        throw new JspException(
  +                            "all members in options Map must be Strings");
  +                    String key = (String) oKey;
  +                    String value = (String) oVal;
  +                    if (value == null)
  +                        value = key;        // use key if value is null
  +
  +                    out.print("<option");
  +                    if (!value.equals(key))
  +                        out.print(" value=\"" + Util.quote(value) + "\"");
  +                    /*
  +                     * This may look confusing: we match the VALUE of
  +                     * this option pair with the KEY of the 'chosen' Map
  +                     * (We want to match <option>s on values, not keys.)
  +                     */
  +                    if ((selected != null && chosen.containsKey(value))
  +                            || (selected == null && dVal != null &&
  +                            value.equals(dVal)))
  +                        out.print(" selected=\"selected\"");
  +                    out.print(">");
  +                    out.print(Util.quote(key));
  +                    out.println("</option>");
  +                }
  +            } else
  +                throw new JspTagException("invalid select: no options");
  +
  +            // close off the surrounding select
  +            out.print("</select>");
  +
  +        } catch (Exception ex) {
  +            throw new JspTagException(ex.getMessage());
  +        }
  +        return SKIP_BODY;
       }
   }
  
  
  
  1.2       +38 -37    jakarta-taglibs/input/src/org/apache/taglibs/input/Text.java
  
  Index: Text.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/src/org/apache/taglibs/input/Text.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Text.java	2000/08/25 03:26:19	1.1
  +++ Text.java	2001/07/14 16:05:03	1.2
  @@ -68,61 +68,62 @@
    *
    *  @version 0.90
    *  @author Shawn Bayern
  + *  @author Lance Lavandowska
    */
   
   public class Text extends TagSupport {
   
  -    private String name;		// name of the text field
  -    private String dVal;		// default value if none is found
  -    private Map attributes;		// attributes of the <input> element
  +    private String name;        // name of the text field
  +    private String dVal;        // default value if none is found
  +    private Map attributes;     // attributes of the <input> element
   
       public void setName(String x) {
  -	name = x;
  +        name = x;
       }
   
       public void setAttributes(Map x) {
  -	attributes = x;
  +        attributes = x;
       }
   
       public void setDefault(String x) {
  -	dVal = x;
  +        dVal = x;
       }
   
       public int doStartTag() throws JspException {
  -	try {
  +        try {
               // sanity check
               if (name == null || name.equals(""))
                   throw new JspTagException("invalid null or empty 'name'");
   
  -	    // get what we need from the page
  -	    ServletRequest req = pageContext.getRequest();
  -	    JspWriter out = pageContext.getOut();
  -
  -	    // start building up the tag
  -	    out.println();
  -	    out.println("<input ");
  -	    out.println("    type=\"text\"");
  -	    out.println("    name=\"" + Util.quote(name) + "\"");
  -
  -	    // include any attributes we've got here
  -	    Util.printAttributes(out, attributes);
  -
  -	    /*
  -	     * print out the value from the request if it's there, or
  -	     * use the default value if it's not
  -	     */
  -	    if (req.getParameter(name) != null)
  -		out.println("    value=\"" 
  -		    + Util.quote(req.getParameter(name)) + "\"");
  -	    else if (dVal != null)
  -		out.println("    value=\"" + Util.quote(dVal) + "\"");
  -
  -	    // end the tag
  -	    out.println("/>");
  -
  -	} catch (Exception ex) {
  -	    throw new JspTagException(ex.getMessage());
  -	}
  -	return SKIP_BODY;
  +            // get what we need from the page
  +            ServletRequest req = pageContext.getRequest();
  +            JspWriter out = pageContext.getOut();
  +
  +            // start building up the tag
  +            out.print("<input type=\"text\" ");
  +            out.print("name=\"" + Util.quote(name) + "\" ");
  +
  +            // include any attributes we've got here
  +            Util.printAttributes(out, attributes);
  +
  +            /*
  +             * print out the value from the request if it's there, or
  +             * use the default value if it's not
  +             */
  +            if (req.getParameter(name) != null)
  +                out.print("value=\"" 
  +                    + Util.quote(req.getParameter(name)) + "\" ");
  +            else if (dVal != null)
  +                out.print("value=\"" + Util.quote(dVal) + "\" ");
  +            else
  +                out.print("value=\"\" ");
  +
  +            // end the tag
  +            out.print("/>");
  +
  +        } catch (Exception ex) {
  +            throw new JspTagException(ex.getMessage());
  +        }
  +        return SKIP_BODY;
       }
   }
  
  
  
  1.2       +37 -38    jakarta-taglibs/input/src/org/apache/taglibs/input/TextArea.java
  
  Index: TextArea.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/src/org/apache/taglibs/input/TextArea.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextArea.java	2000/08/25 03:26:19	1.1
  +++ TextArea.java	2001/07/14 16:05:03	1.2
  @@ -68,62 +68,61 @@
    *
    *  @version 0.90
    *  @author Shawn Bayern
  + *  @author Lance Lavandowska
    */
   
   public class TextArea extends TagSupport {
   
  -    private String name;		// name of the textarea
  -    private String dVal;		// default value if none is found
  -    private Map attributes;		// attributes of the <textarea> element
  +    private String name;        // name of the textarea
  +    private String dVal;        // default value if none is found
  +    private Map attributes;     // attributes of the <textarea> element
   
       public void setName(String x) {
  -	name = x;
  +        name = x;
       }
   
       public void setAttributes(Map x) {
  -	attributes = x;
  +        attributes = x;
       }
   
       public void setDefault(String x) {
  -	dVal = x;
  +        dVal = x;
       }
   
       public int doStartTag() throws JspException {
  -	try {
  +        try {
               // sanity check
               if (name == null || name.equals(""))
                   throw new JspTagException("invalid null or empty 'name'");
   
  -	    // get what we need from the page
  -	    ServletRequest req = pageContext.getRequest();
  -	    JspWriter out = pageContext.getOut();
  -
  -	    // start building up the tag
  -	    out.println();
  -	    out.println("<textarea ");
  -	    out.println("    name=\"" + Util.quote(name) + "\"");
  -
  -	    // include any attributes we've got here
  -	    Util.printAttributes(out, attributes);
  -
  -	    // end the starting tag
  -	    out.println(">");
  -
  -	    /*
  -	     * print out the value from the request if it's there, or
  -	     * use the default value if it's not
  -	     */
  -	    if (req.getParameter(name) != null)
  -		out.print(Util.quote(req.getParameter(name)));
  -	    else if (dVal != null)
  -		out.print(Util.quote(dVal));
  -
  -	    // end the textarea
  -	    out.println("</textarea>");
  -
  -	} catch (Exception ex) {
  -	    throw new JspTagException(ex.getMessage());
  -	}
  -	return SKIP_BODY;
  +            // get what we need from the page
  +            ServletRequest req = pageContext.getRequest();
  +            JspWriter out = pageContext.getOut();
  +
  +            // start building up the tag
  +            out.print("<textarea name=\"" + Util.quote(name) + "\" ");
  +
  +            // include any attributes we've got here
  +            Util.printAttributes(out, attributes);
  +
  +            // end the starting tag
  +            out.print(">");
  +
  +            /*
  +             * print out the value from the request if it's there, or
  +             * use the default value if it's not
  +             */
  +            if (req.getParameter(name) != null)
  +                out.print(Util.quote(req.getParameter(name)));
  +            else if (dVal != null)
  +                out.print(Util.quote(dVal));
  +
  +            // end the textarea
  +            out.print("</textarea>");
  +
  +        } catch (Exception ex) {
  +            throw new JspTagException(ex.getMessage());
  +        }
  +        return SKIP_BODY;
       }
   }
  
  
  
  1.2       +38 -34    jakarta-taglibs/input/src/org/apache/taglibs/input/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/src/org/apache/taglibs/input/Util.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Util.java	2000/08/25 03:26:19	1.1
  +++ Util.java	2001/07/14 16:05:03	1.2
  @@ -74,46 +74,50 @@
    *
    *  @version 0.90
    *  @author Shawn Bayern
  + *  @author Lance Lavandowska
    */
   
   class Util  {
   
       /** Print out any HTML tag attributes we might have been passed. */
       public static void printAttributes(JspWriter out, Map attributes)
  -	    throws JspTagException, IOException {
  -	if (attributes != null) {
  -	    Iterator i = attributes.keySet().iterator();
  -	    while (i.hasNext()) {
  -		Object oKey = i.next();
  -		Object oVal = attributes.get(oKey);
  -
  -		/*
  -		 * If the attribute contains non-Strings, give the user
  -		 * a more meaningful message than what he or she would get
  -		 * if we just propagated a ClassCastException back.
  -		 * (This'll get caught below.)
  -		 */
  -		if (!(oKey instanceof String) || 
  -			(oVal != null && !(oVal instanceof String)))
  -		    throw new JspTagException(
  -			"all members in attributes Map must be Strings");
  -		String key = (String) oKey;
  -		String value = (String) oVal;
  -
  -		// check for illegal keys
  -		if (key.equals("name") || key.equals("value")
  -			|| key.equals("type") || key.equals("checked"))
  -		    throw new JspTagException(
  -			"illegal key '" + key + "'found in attributes Map");
  -
  -		// print the key (and value if appropriate)
  -		if (value == null)
  -		    out.println("    " + quote(key));
  -		else
  -		    out.println("    " + quote(key) + "=\"" 
  -			+ quote(value) + "\"");
  -	    }
  -	}
  +            throws JspTagException, IOException {
  +        if (attributes != null) {
  +            Iterator i = attributes.keySet().iterator();
  +            while (i.hasNext()) {
  +                Object oKey = i.next();
  +                Object oVal = attributes.get(oKey);
  +
  +                /*
  +                 * If the attribute contains non-Strings, give the user
  +                 * a more meaningful message than what he or she would get
  +                 * if we just propagated a ClassCastException back.
  +                 * (This'll get caught below.)
  +                 */
  +                if (!(oKey instanceof String) || 
  +                        (oVal != null && !(oVal instanceof String)))
  +                    throw new JspTagException(
  +                        "all members in attributes Map must be Strings");
  +                String key = (String) oKey;
  +                String value = (String) oVal;
  +
  +                // check for illegal keys
  +                if (key.equals("name") || key.equals("value")
  +                        || key.equals("type") || key.equals("checked"))
  +                    throw new JspTagException(
  +                        "illegal key '" + key + "'found in attributes Map");
  +
  +                /*
  +                 * Print the key and value.
  +                 * If the value is null, make it equal to the key.
  +                 * This follows the conventions of XHTML 1.0
  +                 * and does not break regular HTML.
  +                 */
  +                if (value == null) value = key;
  +
  +                out.print(quote(key) + "=\"" + quote(value) + "\" ");
  +            }
  +        }
       }
   
       /** Quote metacharacters in HTML. */
  
  
  
  1.2       +1 -0      jakarta-taglibs/input/xml/intro.xml
  
  Index: intro.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/input/xml/intro.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- intro.xml	2001/07/01 15:33:44	1.1
  +++ intro.xml	2001/07/14 16:05:04	1.2
  @@ -57,6 +57,7 @@
   
     <ul>
     <li>Shawn Bayern</li>
  +  <li>Lance Lavandowska</li>
     </ul>
   
     </section>