You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/09/05 23:28:06 UTC

cvs commit: jakarta-struts/web/test/WEB-INF web.xml

craigmcc    00/09/05 14:28:06

  Modified:    .        build.xml
  Added:       src/test/org/apache/struts/test TestBean.java
               web/test bean-cookie.jsp bean-define.jsp bean-header.jsp
                        bean-include.jsp bean-parameter.jsp
                        bean-resource.jsp bean-write.jsp index.jsp
               web/test/WEB-INF web.xml
  Log:
  Add a small test suite, in the form of a new web application named
  "struts-test", that can be used to quickly validate the behavior of the
  tags.  The initial tests cover only the beans in the new "struts-bean" tag
  library.
  
  Revision  Changes    Path
  1.15      +45 -5     jakarta-struts/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/build.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- build.xml	2000/09/05 01:33:18	1.14
  +++ build.xml	2000/09/05 21:28:02	1.15
  @@ -3,7 +3,7 @@
     <!-- Initialization properties -->
     <property name="app.name"       value="struts"/>
     <property name="build.home"     value="../build/${app.name}"/>
  -  <property name="catalina.build"  value="../build/catalina"/>
  +  <property name="catalina.build"  value="../build/tomcat-4.0"/>
     <property name="dist.home"      value="../dist/${app.name}"/>
     <property name="tomcat.build"    value="../build/tomcat"/>
   
  @@ -34,6 +34,16 @@
       <copydir src="web/example" dest="${build.home}/example"/>
     </target>
   
  +  <!-- BUILD:  Create directories and copy files for test application -->
  +  <target name="prepare.test">
  +    <mkdir   dir="${build.home}"/>
  +    <mkdir   dir="${build.home}/test"/>
  +    <mkdir   dir="${build.home}/test/WEB-INF"/>
  +    <mkdir   dir="${build.home}/test/WEB-INF/classes"/>
  +    <mkdir   dir="${build.home}/test/WEB-INF/lib"/>
  +    <copydir src="web/test" dest="${build.home}/test"/>
  +  </target>
  +
     <!-- DIST:  Create directories and copy files for distribution -->
     <target name="prepare.dist">
       <mkdir   dir="${dist.home}"/>
  @@ -107,6 +117,24 @@
            includes="*.tld"/>
     </target>
   
  +  <!-- BUILD:  Compile test application components -->
  +  <target name="compile.test"
  +       depends="dist.library,prepare.test">
  +    <javac srcdir="src/test"
  +          destdir="${build.home}/test/WEB-INF/classes"
  +        classpath="${build.home}/library/classes:${servlet.jar}"
  +            debug="true" optimize="false" deprecation="false"/>
  +    <copydir src="src/test" dest="${build.home}/test/WEB-INF/classes">
  +      <include name="**/*.properties" />
  +    </copydir>
  +    <copydir  src="web/test" dest="${build.home}/test"/>
  +    <copyfile src="${dist.home}/lib/${app.name}.jar"
  +             dest="${build.home}/test/WEB-INF/lib/${app.name}.jar"/>
  +    <copydir  src="${dist.home}/lib"
  +             dest="${build.home}/test/WEB-INF"
  +         includes="*.tld"/>
  +  </target>
  +
     <!-- BUILD:  Create Javadoc documentation -->
     <target name="compile.javadoc">
       <deltree  dir="${build.home}/documentation/api"/>
  @@ -144,6 +172,12 @@
             basedir="${build.home}/example" includes="**"/>
     </target>
   
  +  <!-- DIST:  Construct test distributables -->
  +  <target name="dist.test" depends="dist.library,compile.test">
  +    <jar  jarfile="${dist.home}/webapps/${app.name}-test.war"
  +          basedir="${build.home}/test" includes="**"/>
  +  </target>
  +
     <!-- DIST:  Copy sources -->
     <target name="dist.source" depends="prepare.dist">
       <copydir  src="."       dest="${dist.home}/etc"   includes="build.*"/>
  @@ -157,26 +191,32 @@
   
     <!-- DIST:  Construct complete release distribution -->
     <target name="dist"
  -       depends="dist.library,dist.documentation,dist.example,dist.source"/>
  +       depends="dist.library,dist.documentation,dist.example,dist.test,dist.source"/>
   
     <!-- DEPLOY:  Deploy these applications on Catalina -->
  -  <target name="deploy.catalina" depends="compile.documentation,compile.example">
  +  <target name="deploy.catalina" depends="compile.documentation,compile.example,compile.test">
       <mkdir   dir="${catalina.build}/webapps/struts-documentation"/>
       <copydir src="${build.home}/documentation"
               dest="${catalina.build}/webapps/struts-documentation"/>
       <mkdir   dir="${catalina.build}/webapps/struts-example"/>
       <copydir src="${build.home}/example"
               dest="${catalina.build}/webapps/struts-example"/>
  +    <mkdir   dir="${catalina.build}/webapps/struts-test"/>
  +    <copydir src="${build.home}/test"
  +            dest="${catalina.build}/webapps/struts-test"/>
     </target>
   
     <!-- DEPLOY:  Deploy these applications on Tomcat -->
  -  <target name="deploy.tomcat" depends="compile.documentation,compile.example">
  +  <target name="deploy.tomcat" depends="compile.documentation,compile.example,compile.test">
       <mkdir   dir="${tomcat.build}/webapps/struts-documentation"/>
       <copydir src="${build.home}/documentation"
               dest="${tomcat.build}/webapps/struts-documentation"/>
       <mkdir   dir="${tomcat.build}/webapps/struts-example"/>
       <copydir src="${build.home}/example"
               dest="${tomcat.build}/webapps/struts-example"/>
  +    <mkdir   dir="${tomcat.build}/webapps/struts-test"/>
  +    <copydir src="${build.home}/test"
  +            dest="${tomcat.build}/webapps/struts-test"/>
     </target>
   
     <!-- UTILITY:  Clean up build and distribution directories -->
  @@ -187,6 +227,6 @@
   
     <!-- UTILITY:  All-in-one build target -->
     <target name="all"
  -       depends="clean,compile.library,compile.documentation,compile.example"/>
  +       depends="clean,compile.library,compile.documentation,compile.example,compile.test"/>
   
   </project>
  
  
  
  1.1                  jakarta-struts/src/test/org/apache/struts/test/TestBean.java
  
  Index: TestBean.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/test/TestBean.java,v 1.1 2000/09/05 21:28:03 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/09/05 21:28:03 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.struts.test;
  
  
  /**
   * General purpose test bean for Struts custom tag tests.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/09/05 21:28:03 $
   */
  
  public class TestBean {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * A boolean property.
       */
      private boolean booleanProperty = true;
  
      public boolean getBooleanProperty() {
          return (booleanProperty);
      }
  
      public void setBooleanProperty(boolean booleanProperty) {
          this.booleanProperty = booleanProperty;
      }
  
  
      /**
       * A double property.
       */
      private double doubleProperty = 321.0;
  
      public double getDoubleProperty() {
          return (this.doubleProperty);
      }
  
      public void setDoubleProperty(double doubleProperty) {
          this.doubleProperty = doubleProperty;
      }
  
  
      /**
       * A float property.
       */
      private float floatProperty = (float) 123.0;
  
      public float getFloatProperty() {
          return (this.floatProperty);
      }
  
      public void setFloatProperty(float floatProperty) {
          this.floatProperty = floatProperty;
      }
  
  
      /**
       * An integer property.
       */
      private int intProperty = 123;
  
      public int getIntProperty() {
          return (this.intProperty);
      }
  
      public void setIntProperty(int intProperty) {
          this.intProperty = intProperty;
      }
  
  
      /**
       * An integer array that is accessed as an array as well as indexed.
       */
      private int intArray[] = { 0, 10, 20, 30, 40 };
  
      public int[] getIntArray() {
          return (this.intArray);
      }
  
      public void setIntArray(int intArray[]) {
          this.intArray = intArray;
      }
  
      public int getIntIndexed(int index) {
          return (intArray[index]);
      }
  
      public void setIntIndexed(int index, int value) {
          intArray[index] = value;
      }
  
  
      /**
       * A nested reference to another test bean (populated as needed).
       */
      private TestBean nested = null;
  
      public TestBean getNested() {
          if (nested == null)
              nested = new TestBean();
          return (nested);
      }
  
  
      /**
       * A long property.
       */
      private long longProperty = 321;
  
      public long getLongProperty() {
          return (this.longProperty);
      }
  
      public void setLongProperty(long longProperty) {
          this.longProperty = longProperty;
      }
  
  
      /**
       * A String property.
       */
      private String stringProperty = "This is a string";
  
      public String getStringProperty() {
          return (this.stringProperty);
      }
  
      public void setStringProperty(String stringProperty) {
          this.stringProperty = stringProperty;
      }
  
  
      /**
       * A String array that is accessed as an array as well as indexed.
       */
      private String stringArray[] =
      { "String 0", "String 1", "String 2", "String 3", "String 4" };
  
      public String[] getStringArray() {
          return (this.stringArray);
      }
  
      public void setStringArray(String stringArray[]) {
          this.stringArray = stringArray;
      }
  
      public String getStringIndexed(int index) {
          return (stringArray[index]);
      }
  
      public void setStringIndexed(int index, String value) {
          stringArray[index] = value;
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/web/test/bean-cookie.jsp
  
  Index: bean-cookie.jsp
  ===================================================================
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <html>
  <head>
  <title>Test struts-bean:cookie Tag</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Test struts-bean:cookie Tag</h1>
  </div>
  
  Display the properties of our current session ID cookie
  
  <bean:cookie id="sess" name="JSESSIONID"/>
  
  <table border="1">
    <tr>
      <th>Property Name</th>
      <th>Correct Value</th>
      <th>Test Result</th>
    </tr>
    <tr>
      <td>comment</td>
      <td><jsp:getProperty name="sess" property="comment"/></td>
      <td><bean:write name="sess" property="comment"/></td>
    </tr>
    <tr>
      <td>domain</td>
      <td><jsp:getProperty name="sess" property="domain"/></td>
      <td><bean:write name="sess" property="domain"/></td>
    </tr>
    <tr>
      <td>maxAge</td>
      <td><jsp:getProperty name="sess" property="maxAge"/></td>
      <td><bean:write name="sess" property="maxAge"/></td>
    </tr>
    <tr>
      <td>name</td>
      <td><jsp:getProperty name="sess" property="name"/></td>
      <td><bean:write name="sess" property="name"/></td>
    </tr>
    <tr>
      <td>path</td>
      <td><jsp:getProperty name="sess" property="path"/></td>
      <td><bean:write name="sess" property="path"/></td>
    </tr>
    <tr>
      <td>secure</td>
      <td><jsp:getProperty name="sess" property="secure"/></td>
      <td><bean:write name="sess" property="secure"/></td>
    </tr>
    <tr>
      <td>value</td>
      <td><jsp:getProperty name="sess" property="value"/></td>
      <td><bean:write name="sess" property="value"/></td>
    </tr>
    <tr>
      <td>version</td>
      <td><jsp:getProperty name="sess" property="version"/></td>
      <td><bean:write name="sess" property="version"/></td>
    </tr>
  </table>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-struts/web/test/bean-define.jsp
  
  Index: bean-define.jsp
  ===================================================================
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <html>
  <head>
  <title>Test struts-bean:define Tag</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Test struts-bean:define Tag</h1>
  </div>
  
  <h3>Test 1 -- Direct Scalar Variable Defines</h3>
  
  <jsp:useBean id="test1" scope="page" class="org.apache.struts.test.TestBean"/>
  
  <bean:define id="test1_boolean" name="test1" property="booleanProperty"/>
  <bean:define id="test1_double" name="test1" property="doubleProperty"/>
  <bean:define id="test1_float" name="test1" property="floatProperty"/>
  <bean:define id="test1_int" name="test1" property="intProperty"/>
  <bean:define id="test1_long" name="test1" property="longProperty"/>
  <bean:define id="test1_string" name="test1" property="stringProperty"/>
  
  <table border="1">
    <tr>
      <th>Data Type</th>
      <th>Correct Value</th>
      <th>Test Result</th>
    </tr>
    <tr>
      <td>boolean</td>
      <td><jsp:getProperty name="test1" property="booleanProperty"/></td>
      <td><%= test1_boolean %></td>
    </tr>
    <tr>
      <td>double</td>
      <td><jsp:getProperty name="test1" property="doubleProperty"/></td>
      <td><%= test1_double %></td>
    </tr>
    <tr>
      <td>float</td>
      <td><jsp:getProperty name="test1" property="floatProperty"/></td>
      <td><%= test1_float %></td>
    </tr>
    <tr>
      <td>int</td>
      <td><jsp:getProperty name="test1" property="intProperty"/></td>
      <td><%= test1_int %></td>
    </tr>
    <tr>
      <td>long</td>
      <td><jsp:getProperty name="test1" property="longProperty"/></td>
      <td><%= test1_long %></td>
    </tr>
    <tr>
      <td>string</td>
      <td><jsp:getProperty name="test1" property="stringProperty"/></td>
      <td><%= test1_string %></td>
    </tr>
  </table>
  
  
  <h3>Test 2 -- Nested Scalar Variable Defines</h3>
  
  <jsp:useBean id="test2" scope="page" class="org.apache.struts.test.TestBean"/>
  
  <bean:define id="test2_boolean" name="test2" property="nested.booleanProperty"/>
  <bean:define id="test2_double" name="test2" property="nested.doubleProperty"/>
  <bean:define id="test2_float" name="test2" property="nested.floatProperty"/>
  <bean:define id="test2_int" name="test2" property="nested.intProperty"/>
  <bean:define id="test2_long" name="test2" property="nested.longProperty"/>
  <bean:define id="test2_string" name="test2" property="nested.stringProperty"/>
  
  <table border="1">
    <tr>
      <th>Data Type</th>
      <th>Correct Value</th>
      <th>Test Result</th>
    </tr>
    <tr>
      <td>boolean</td>
      <td><jsp:getProperty name="test2" property="booleanProperty"/></td>
      <td><%= test2_boolean %></td>
    </tr>
    <tr>
      <td>double</td>
      <td><jsp:getProperty name="test2" property="doubleProperty"/></td>
      <td><%= test2_double %></td>
    </tr>
    <tr>
      <td>float</td>
      <td><jsp:getProperty name="test2" property="floatProperty"/></td>
      <td><%= test2_float %></td>
    </tr>
    <tr>
      <td>int</td>
      <td><jsp:getProperty name="test2" property="intProperty"/></td>
      <td><%= test2_int %></td>
    </tr>
    <tr>
      <td>long</td>
      <td><jsp:getProperty name="test2" property="longProperty"/></td>
      <td><%= test2_long %></td>
    </tr>
    <tr>
      <td>string</td>
      <td><jsp:getProperty name="test2" property="stringProperty"/></td>
      <td><%= test2_string %></td>
    </tr>
  </table>
  
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-struts/web/test/bean-header.jsp
  
  Index: bean-header.jsp
  ===================================================================
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <html>
  <head>
  <title>Test struts-bean:header Tag</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Test struts-bean:header Tag</h1>
  </div>
  
  Display the values of the headers included in this request.<br><br>
  <%
     java.util.Enumeration names =
       ((HttpServletRequest) request).getHeaderNames();
  %>
  
  <table border="1">
    <tr>
      <th>Header Name</th>
      <th>Header Value</th>
    </tr>
  <%
    while (names.hasMoreElements()) {
      String name = (String) names.nextElement();
  %>
      <bean:header id="head" name="<%= name %>"/>
      <tr>
        <td><%= name %></td>
        <td><%= head %></td>
      </tr>
  <%
    }
  %>
  </table>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-struts/web/test/bean-include.jsp
  
  Index: bean-include.jsp
  ===================================================================
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <html>
  <head>
  <title>Test struts-bean:include Tag</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Test struts-bean:include Tag</h1>
  </div>
  
  <bean:include id="index" name="/index.jsp"/>
  
  <p>Display the contents returned by invoking <code>/index.jsp</code>
  directly, with no filtering.</p>
  <hr>
  <pre>
  <%= index %>
  </pre>
  <hr>
  
  <p>Display the contents returned by invoking <code>/index.jsp</code>
  directly, with filtering.</p>
  <hr>
  <pre>
  <bean:write name="index" filter="true"/>
  </pre>
  </hr>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-struts/web/test/bean-parameter.jsp
  
  Index: bean-parameter.jsp
  ===================================================================
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <html>
  <head>
  <title>Test struts-bean:parameter Tag</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Test struts-bean:parameter Tag</h1>
  </div>
  
  <p>If called from the <code>index.jsp</code> page, two request parameters will
  be included and their values displayed below.  If you call this page without
  including the appropriate request parameters, you will receive a JSP runtime
  error instead.</p>
  
  <bean:parameter id="param1" name="param1"/>
  <bean:parameter id="param2" name="param2"/>
  
  <table border="1">
    <tr>
      <th>Parameter Name</th>
      <th>Correct Value</th>
      <th>Test Result</th>
    </tr>
    <tr>
      <td>param1</td>
      <td>value1</td>
      <td><%= param1 %></td>
    </tr>
    <tr>
      <td>param2</td>
      <td>value2</td>
      <td><%= param2 %></td>
    </tr>
  </table>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-struts/web/test/bean-resource.jsp
  
  Index: bean-resource.jsp
  ===================================================================
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <html>
  <head>
  <title>Test struts-bean:resource Tag</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Test struts-bean:resource Tag</h1>
  </div>
  <bean:resource id="webxml" name="/WEB-INF/web.xml"/>
  
  <p>Display the contents of the <code>WEB-INF/web.xml</code> resource for this
  web application, with no filtering.</p>
  <hr>
  <pre>
  <%= webxml %>
  </pre>
  <hr>
  
  <p>Display the contents of the <code>WEB-INF/web.xml</code> resource for this
  web application, with filtering.</p>
  <hr>
  <pre>
  <bean:write name="webxml" filter="true"/>
  </pre>
  <hr>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-struts/web/test/bean-write.jsp
  
  Index: bean-write.jsp
  ===================================================================
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <html>
  <head>
  <title>Test struts-bean:write Tag</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>Test struts-bean:write Tag</h1>
  </div>
  
  <h3>Test 1 -- Scalar Variable Lookups</h3>
  
  <%
    pageContext.setAttribute("test1.boolean", new Boolean(true));
    pageContext.setAttribute("test1.double", new Double(321.0));
    pageContext.setAttribute("test1.float", new Float((float) 123.0));
    pageContext.setAttribute("test1.int", new Integer(123));
    pageContext.setAttribute("test1.long", new Long(321));
    pageContext.setAttribute("test1.string", "This is a string");
  %>
  
  <table border="1">
  <tr>
    <th>Data Type</th>
    <th>Correct Value</th>
    <th>Test Result</th>
  </tr>
  <tr>
    <td>boolean</td>
    <td><%= pageContext.getAttribute("test1.boolean") %></td>
    <td><bean:write name="test1.boolean"/></td>
  </tr>
  <tr>
    <td>double</td>
    <td><%= pageContext.getAttribute("test1.double") %></td>
    <td><bean:write name="test1.double"/></td>
  </tr>
  <tr>
    <td>float</td>
    <td><%= pageContext.getAttribute("test1.float") %></td>
    <td><bean:write name="test1.float"/></td>
  </tr>
  <tr>
    <td>int</td>
    <td><%= pageContext.getAttribute("test1.int") %></td>
    <td><bean:write name="test1.int"/></td>
  </tr>
  <tr>
    <td>long</td>
    <td><%= pageContext.getAttribute("test1.long") %></td>
    <td><bean:write name="test1.long"/></td>
  </tr>
  <tr>
    <td>String</td>
    <td><%= pageContext.getAttribute("test1.string") %></td>
    <td><bean:write name="test1.string"/></td>
  </tr>
  </table>
  
  <h3>Test 2 -- Scalar Property Lookups</h3>
  
  <jsp:useBean id="test2" scope="page" class="org.apache.struts.test.TestBean"/>
  
  <table border="1">
  <tr>
    <th>Data Type</th>
    <th>Correct Value</th>
    <th>Test Result</th>
  </tr>
  <tr>
    <td>boolean</td>
    <td><jsp:getProperty name="test2" property="booleanProperty"/>
    <td><bean:write name="test2" property="booleanProperty"/></td>
  </tr>
  <tr>
    <td>double</td>
    <td><jsp:getProperty name="test2" property="doubleProperty"/></td>
    <td><bean:write name="test2" property="doubleProperty"/></td>
  </tr>
  <tr>
    <td>float</td>
    <td><jsp:getProperty name="test2" property="floatProperty"/></td>
    <td><bean:write name="test2" property="floatProperty"/></td>
  </tr>
  <tr>
    <td>int</td>
    <td><jsp:getProperty name="test2" property="intProperty"/></td>
    <td><bean:write name="test2" property="intProperty"/></td>
  </tr>
  <tr>
    <td>long</td>
    <td><jsp:getProperty name="test2" property="longProperty"/></td>
    <td><bean:write name="test2" property="longProperty"/></td>
  </tr>
  <tr>
    <td>String</td>
    <td><jsp:getProperty name="test2" property="stringProperty"/></td>
    <td><bean:write name="test2" property="stringProperty"/></td>
  </tr>
  </table>
  
  <h3>Test 3 - Integer Array And Indexed Lookups</h3>
  
  <jsp:useBean id="test3" scope="page" class="org.apache.struts.test.TestBean"/>
  
  <table border="1">
  <tr>
    <th>Correct Value</th>
    <th>Array Result</th>
    <th>Indexed Result</th>
  </tr>
  <% for (int index = 0; index < 5; index++) { %>
    <tr>
      <td><%= index * 10 %></td>
      <td><bean:write name="test3" property='<%= "intArray[" + index + "]"%>'/></td>
      <td><bean:write name="test3" property='<%= "intIndexed[" + index + "]"%>'/></td>
    </tr>
  <% } %>
  </table>
  
  
  <h3>Test 4 - String Array And Indexed Lookups</h3>
  
  <jsp:useBean id="test4" scope="page" class="org.apache.struts.test.TestBean"/>
  
  <table border="1">
  <tr>
    <th>Correct Value</th>
    <th>Array Result</th>
    <th>Indexed Result</th>
  </tr>
  <% for (int index = 0; index < 5; index++) { %>
    <tr>
      <td><%= "String " + index %></td>
      <td><bean:write name="test4" property='<%= "stringArray[" + index + "]"%>'/></td>
      <td><bean:write name="test4" property='<%= "stringIndexed[" + index + "]"%>'/></td>
    </tr>
  <% } %>
  </table>
  
  
  <h3>Test 5 -- Nested Scalar Property Lookups</h3>
  
  <jsp:useBean id="test5" scope="page" class="org.apache.struts.test.TestBean"/>
  
  <table border="1">
  <tr>
    <th>Data Type</th>
    <th>Correct Value</th>
    <th>Test Result</th>
  </tr>
  <tr>
    <td>boolean</td>
    <td><jsp:getProperty name="test5" property="booleanProperty"/>
    <td><bean:write name="test5" property="nested.booleanProperty"/></td>
  </tr>
  <tr>
    <td>double</td>
    <td><jsp:getProperty name="test5" property="doubleProperty"/></td>
    <td><bean:write name="test5" property="nested.doubleProperty"/></td>
  </tr>
  <tr>
    <td>float</td>
    <td><jsp:getProperty name="test5" property="floatProperty"/></td>
    <td><bean:write name="test5" property="nested.floatProperty"/></td>
  </tr>
  <tr>
    <td>int</td>
    <td><jsp:getProperty name="test5" property="intProperty"/></td>
    <td><bean:write name="test5" property="nested.intProperty"/></td>
  </tr>
  <tr>
    <td>long</td>
    <td><jsp:getProperty name="test5" property="longProperty"/></td>
    <td><bean:write name="test5" property="nested.longProperty"/></td>
  </tr>
  <tr>
    <td>String</td>
    <td><jsp:getProperty name="test5" property="stringProperty"/></td>
    <td><bean:write name="test5" property="nested.stringProperty"/></td>
  </tr>
  </table>
  
  <h3>Test 6 - Nested Integer Array And Indexed Lookups</h3>
  
  <jsp:useBean id="test6" scope="page" class="org.apache.struts.test.TestBean"/>
  
  <table border="1">
  <tr>
    <th>Correct Value</th>
    <th>Array Result</th>
    <th>Indexed Result</th>
  </tr>
  <% for (int index = 0; index < 5; index++) { %>
    <tr>
      <td><%= index * 10 %></td>
      <td><bean:write name="test6" property='<%= "nested.intArray[" + index + "]"%>'/></td>
      <td><bean:write name="test6" property='<%= "nested.intIndexed[" + index + "]"%>'/></td>
    </tr>
  <% } %>
  </table>
  
  
  </body>
  </html>
  
  
  
  
  1.1                  jakarta-struts/web/test/index.jsp
  
  Index: index.jsp
  ===================================================================
  <html>
  <head>
  <title>Struts Test Application</title>
  </head>
  <body bgcolor="white">
  
  <div align="center">
  <h1>STRUTS Test Pages</h1>
  </div>
  
  <h3>BEAN Tags</h3>
  <ul>
  <li><a href="bean-cookie.jsp">&lt;struts-bean:cookie&gt;</a>
  <li><a href="bean-define.jsp">&lt;struts-bean:define&gt;</a>
  <li><a href="bean-header.jsp">&lt;struts-bean:header&gt;</a>
  <li><a href="bean-include.jsp">&lt;struts-bean:include&gt;</a>
  <li><a href="bean-parameter.jsp?param1=value1&param2=value2">&lt;struts-bean:parameter&gt;</a>
  <li><a href="bean-resource.jsp">&lt;struts-bean:resource&gt;</a>
  <li><a href="bean-write.jsp">&lt;struts-bean:write&gt;</a>
  </ul>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-struts/web/test/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
  
  <web-app>
  
  
    <!-- The Welcome File List -->
    <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>index.html</welcome-file>
    </welcome-file-list>
  
    <!-- Struts Tag Library Descriptors -->
    <taglib>
      <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
  
  
  </web-app>