You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ms...@locus.apache.org on 2000/12/19 20:23:08 UTC
cvs commit: jakarta-struts/web/upload/WEB-INF/classes/org/apache/struts/example/upload UploadAction.java UploadForm.java
mschachter 00/12/19 11:23:07
Modified: . build.xml
src/share/org/apache/struts/taglib/form SubmitTag.java
Added: web/upload display.jsp upload.jsp
web/upload/WEB-INF struts-config.xml web.xml
web/upload/WEB-INF/classes/org/apache/struts/example/upload
UploadAction.java UploadForm.java
Log:
- created a bare-bones demonstration of how to utilize file uploading in
struts
- the file will be build in the binary distribution as
/webapps/struts-upload.war
Revision Changes Path
1.23 +386 -350 jakarta-struts/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/build.xml,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- build.xml 2000/11/29 06:52:02 1.22
+++ build.xml 2000/12/19 19:23:00 1.23
@@ -1,350 +1,386 @@
-<project name="Struts" default="compile.library" basedir=".">
-
- <!-- Initialization properties -->
- <property name="app.name" value="struts"/>
- <property name="build.home" value="../build/${app.name}"/>
- <property name="catalina.home" value="../build/tomcat-4.0"/>
- <property name="dist.home" value="../dist/${app.name}"/>
- <property name="project.name" value="jakarta-struts"/>
- <property name="project.version" value="1.0-dev"/>
- <property name="tomcat.home" value="../build/tomcat"/>
-
- <!-- BUILD: Create directories and copy files for library -->
- <target name="prepare.library">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/library"/>
- <mkdir dir="${build.home}/library/classes"/>
- <mkdir dir="${build.home}/library/classes/META-INF"/>
- <mkdir dir="${build.home}/library/classes/META-INF/tlds"/>
- <copy file="src/conf/struts.tld"
- tofile="${build.home}/library/classes/META-INF/taglib.tld"/>
- <mkdir dir="${build.home}/library/classes/org"/>
- <mkdir dir="${build.home}/library/classes/org/apache"/>
- <mkdir dir="${build.home}/library/classes/org/apache/struts"/>
- <mkdir dir="${build.home}/library/classes/org/apache/struts/resources"/>
- <copy todir="${build.home}/library/classes/org/apache/struts/resources">
- <fileset dir="src/conf" includes="**/*.dtd"/>
- </copy>
- </target>
-
- <!-- BUILD: Create directories and copy files for documentation app -->
- <target name="prepare.documentation">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/documentation"/>
- <mkdir dir="${build.home}/documentation/dtds"/>
- <copy todir="${build.home}/documentation/dtds">
- <fileset dir="src/conf" includes="**/*.dtd"/>
- </copy>
- <mkdir dir="${build.home}/documentation/WEB-INF"/>
- <mkdir dir="${build.home}/documentation/WEB-INF/classes"/>
- <mkdir dir="${build.home}/documentation/WEB-INF/lib"/>
- <copy todir="${build.home}/documentation">
- <fileset dir="web/documentation"/>
- </copy>
- </target>
-
- <!-- BUILD: Create directories and copy files for example application -->
- <target name="prepare.example">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/example"/>
- <mkdir dir="${build.home}/example/WEB-INF"/>
- <mkdir dir="${build.home}/example/WEB-INF/classes"/>
- <mkdir dir="${build.home}/example/WEB-INF/lib"/>
- <copy todir="${build.home}/example">
- <fileset dir="web/example"/>
- </copy>
- </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"/>
- <copy todir="${build.home}/test">
- <fileset dir="web/test"/>
- </copy>
- </target>
-
- <!-- BUILD: Create directories and copy files for template example -->
- <target name="prepare.template">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/template"/>
- <mkdir dir="${build.home}/template/css"/>
- <mkdir dir="${build.home}/template/graphics"/>
- <mkdir dir="${build.home}/template/WEB-INF"/>
- <mkdir dir="${build.home}/template/WEB-INF/lib"/>
- <mkdir dir="${build.home}/template/WEB-INF/tlds"/>
- <copy todir="${build.home}/template">
- <fileset dir="web/template-example"/>
- </copy>
- </target>
-
- <!-- DIST: Create directories and copy files for distribution -->
- <target name="prepare.dist">
- <mkdir dir="${dist.home}"/>
- <mkdir dir="${dist.home}/etc"/>
- <mkdir dir="${dist.home}/lib"/>
- <mkdir dir="${dist.home}/src"/>
- <mkdir dir="${dist.home}/web"/>
- <mkdir dir="${dist.home}/webapps"/>
- </target>
-
- <!-- BUILD: Compile library directory components -->
- <target name="compile.library" depends="prepare.library">
- <javac srcdir="src/share" destdir="${build.home}/library/classes"
- classpath="${servlet.jar}"
- debug="true" optimize="false" deprecation="false"/>
- <copy todir="${build.home}/library/classes">
- <fileset dir="src/share" includes="**/*.properties"/>
- </copy>
- <copy todir="${build.home}/library">
- <fileset dir="src/conf" includes="*.dtd"/>
- <fileset dir="src/conf" includes="*.tld"/>
- </copy>
- <style basedir="src/doc" destdir="${build.home}/library"
- extension=".tld" style="stylesheets/tld.xsl"
- includes="struts-*.xml"/>
- <copy todir="${build.home}/library/classes/META-INF/tlds">
- <fileset dir="${build.home}/library" includes="struts-*.tld"/>
- </copy>
- </target>
-
- <!-- BUILD: Compile documentation application components -->
- <target name="compile.documentation"
- depends="dist.library,prepare.documentation">
-
- <!-- Compile beans and tags required by the documentation app -->
-<!--
- <javac srcdir="src/documentation"
- destdir="${build.home}/documentation/WEB-INF/classes"
- classpath="${build.home}/library/classes:${servlet.jar}"
- debug="true" optimize="false" deprecation="false"/>
--->
-
- <!-- Copy Struts JAR file and TLDs to the documentation app -->
- <copy file="${dist.home}/lib/${app.name}.jar"
- tofile="${build.home}/documentation/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/documentation/WEB-INF">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
-
- <!-- Copy static documentation content -->
- <copy file="TODO" tofile="${build.home}/documentation/todo.txt"/>
- <copy todir="${build.home}/documentation">
- <fileset dir="web/documentation"/>
- </copy>
-
- <!-- Create dynamically generated documentation -->
- <style basedir="src/doc" destdir="${build.home}/documentation"
- extension=".html" style="stylesheets/struts.xsl" includes="*.xml"/>
- <copy todir="${build.home}/documentation">
- <fileset dir="src/doc">
- <include name="**/*.css"/>
- <include name="**/*.gif"/>
- <include name="**/*.html"/>
- <include name="**/*.jpg"/>
- <include name="**/*.js"/>
- </fileset>
- </copy>
- </target>
-
- <!-- BUILD: Compile example application components -->
- <target name="compile.example"
- depends="dist.library,prepare.example">
- <javac srcdir="src/example"
- destdir="${build.home}/example/WEB-INF/classes"
- classpath="${build.home}/library/classes:${servlet.jar}"
- debug="true" optimize="false" deprecation="false"/>
- <copy todir="${build.home}/example/WEB-INF/classes">
- <fileset dir="src/example" includes="**/*.properties"/>
- </copy>
- <copy todir="${build.home}/example">
- <fileset dir="web/example"/>
- </copy>
- <copy file="${dist.home}/lib/${app.name}.jar"
- tofile="${build.home}/example/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/example/WEB-INF">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
- </target>
-
- <!-- BUILD: Compile template example application components -->
- <target name="compile.template"
- depends="dist.library,prepare.template">
- <copy todir="${build.home}/template">
- <fileset dir="web/template-example"/>
- </copy>
- <copy file="${dist.home}/lib/${app.name}.jar"
- tofile="${build.home}/template/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/template/WEB-INF/tlds">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
- </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"/>
- <copy todir="${build.home}/test/WEB-INF/classes">
- <fileset dir="src/test" includes="**/*.properties"/>
- </copy>
- <copy todir="${build.home}/test">
- <fileset dir="web/test"/>
- </copy>
- <copy file="${dist.home}/lib/${app.name}.jar"
- tofile="${build.home}/test/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/test/WEB-INF">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
- </target>
-
- <!-- BUILD: Create Javadoc documentation -->
- <target name="compile.javadoc">
- <delete dir="${build.home}/documentation/api"/>
- <mkdir dir="${build.home}/documentation/api"/>
- <javadoc sourcepath="src/share"
- destdir="${build.home}/documentation/api"
- packagenames="org.apache.struts.*"
- author="true"
- private="true"
- version="true"
- windowtitle="Apache Struts API Documentation"
- doctitle="<h1>Apache Struts Framework</h1>"
- bottom="Copyright © 2000 - Apache Software Foundation"/>
- </target>
-
- <!-- DIST: Construct library distributables -->
- <target name="dist.library" depends="prepare.dist,compile.library">
- <copy todir="${dist.home}/lib">
- <fileset dir="${build.home}/library" includes="*.dtd"/>
- <fileset dir="${build.home}/library" includes="*.tld"/>
- </copy>
- <jar jarfile="${dist.home}/lib/${app.name}.jar"
- manifest="src/conf/MANIFEST.MF"
- basedir="${build.home}/library/classes" includes="**"/>
- </target>
-
- <!-- DIST: Construct documentation distributables -->
- <target name="dist.documentation"
- depends="dist.library,compile.documentation,compile.javadoc">
- <jar jarfile="${dist.home}/webapps/${app.name}-documentation.war"
- basedir="${build.home}/documentation" includes="**"/>
- </target>
-
- <!-- DIST: Construct example distributables -->
- <target name="dist.example" depends="dist.library,compile.example">
- <jar jarfile="${dist.home}/webapps/${app.name}-example.war"
- basedir="${build.home}/example" includes="**"/>
- </target>
-
- <!-- DIST: Construct template example distributables -->
- <target name="dist.template" depends="dist.library,compile.template">
- <jar jarfile="${dist.home}/webapps/${app.name}-template.war"
- basedir="${build.home}/template" 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">
- <copy todir="${dist.home}/etc">
- <fileset dir="." includes="build.*"/>
- </copy>
- <copy file="INSTALL" tofile="${dist.home}/INSTALL"/>
- <copy file="LICENSE" tofile="${dist.home}/LICENSE"/>
- <copy file="README" tofile="${dist.home}/README"/>
- <copy file="TODO" tofile="${dist.home}/TODO"/>
- <copy todir="${dist.home}/src">
- <fileset dir="src"/>
- </copy>
- <copy todir="${dist.home}/web">
- <fileset dir="web"/>
- </copy>
- </target>
-
- <!-- DIST: Construct complete release distribution -->
- <target name="dist"
- depends="dist.library,dist.documentation,dist.example,dist.template,dist.test,dist.source"/>
-
- <!-- DEPLOY: Deploy these applications on Catalina -->
- <target name="deploy.catalina" depends="compile.documentation,compile.example,compile.template,compile.test">
- <mkdir dir="${catalina.home}/webapps/struts-documentation"/>
- <copy todir="${catalina.home}/webapps/struts-documentation">
- <fileset dir="${build.home}/documentation"/>
- </copy>
- <mkdir dir="${catalina.home}/webapps/struts-example"/>
- <copy todir="${catalina.home}/webapps/struts-example">
- <fileset dir="${build.home}/example"/>
- </copy>
- <mkdir dir="${catalina.home}/webapps/struts-template"/>
- <copy todir="${catalina.home}/webapps/struts-template">
- <fileset dir="${build.home}/template"/>
- </copy>
- <mkdir dir="${catalina.home}/webapps/struts-test"/>
- <copy todir="${catalina.home}/webapps/struts-test">
- <fileset dir="${build.home}/test"/>
- </copy>
- </target>
-
- <!-- DEPLOY: Deploy these applications on Tomcat -->
- <target name="deploy.tomcat" depends="compile.documentation,compile.example,compile.template,compile.test">
- <mkdir dir="${tomcat.home}/webapps/struts-documentation"/>
- <copy todir="${tomcat.home}/webapps/struts-documentation">
- <fileset dir="${build.home}/documentation"/>
- </copy>
- <mkdir dir="${tomcat.home}/webapps/struts-example"/>
- <copy todir="${tomcat.home}/webapps/struts-example">
- <fileset dir="${build.home}/example"/>
- </copy>
- <mkdir dir="${tomcat.home}/webapps/struts-template"/>
- <copy todir="${tomcat.home}/webapps/struts-template">
- <fileset dir="${build.home}/template"/>
- </copy>
- <mkdir dir="${tomcat.home}/webapps/struts-test"/>
- <copy todir="${tomcat.home}/webapps/struts-test">
- <fileset dir="${build.home}/test"/>
- </copy>
- </target>
-
- <!-- UTILITY: Display all targets intended for developer use -->
- <target name="targets">
- <echo message=""/>
- <echo message="ANT build for ${project.name} ${project.version}"/>
- <echo message=""/>
- <echo message="The following targets are available:"/>
- <echo message=" all Cleans and builds library and webapps"/>
- <echo message=" clean Cleans the build and distribution directories"/>
- <echo message=" compile.documentation Builds the documentation webapp"/>
- <echo message=" compile.examples Builds the examples webapp"/>
- <echo message=" compile.javadoc Builds Javadoc API docs for Struts"/>
- <echo message=" compile.library Builds the main packages"/>
- <echo message=" compile.template Builds the template example webapp"/>
- <echo message=" compile.test Builds the tests webapp"/>
- <echo message=" deploy.catalina Deploys build to Catalina build directory"/>
- <echo message=" deploy.tomcat Depoys build to Tomcat build directory"/>
- <echo message=" dist Builds binary distribution in dist directory"/>
- <echo message=""/>
- <echo message="Default target is 'compile.library'"/>
- </target>
-
- <!-- UTILITY: Clean up build and distribution directories -->
- <target name="clean">
- <delete dir="${build.home}"/>
- <delete dir="${dist.home}"/>
- </target>
-
- <!-- UTILITY: All-in-one build target -->
- <target name="all"
- depends="clean,compile.library,compile.documentation,compile.example,compile.test"/>
-
-</project>
+<project name="Struts" default="compile.library" basedir=".">
+
+ <!-- Initialization properties -->
+ <property name="app.name" value="struts"/>
+ <property name="build.home" value="../build/${app.name}"/>
+ <property name="catalina.home" value="../build/tomcat-4.0"/>
+ <property name="dist.home" value="../dist/${app.name}"/>
+ <property name="project.name" value="jakarta-struts"/>
+ <property name="project.version" value="1.0-dev"/>
+ <property name="tomcat.home" value="../build/tomcat"/>
+
+ <!-- BUILD: Create directories and copy files for library -->
+ <target name="prepare.library">
+ <mkdir dir="${build.home}"/>
+ <mkdir dir="${build.home}/library"/>
+ <mkdir dir="${build.home}/library/classes"/>
+ <mkdir dir="${build.home}/library/classes/META-INF"/>
+ <mkdir dir="${build.home}/library/classes/META-INF/tlds"/>
+ <copy file="src/conf/struts.tld"
+ tofile="${build.home}/library/classes/META-INF/taglib.tld"/>
+ <mkdir dir="${build.home}/library/classes/org"/>
+ <mkdir dir="${build.home}/library/classes/org/apache"/>
+ <mkdir dir="${build.home}/library/classes/org/apache/struts"/>
+ <mkdir dir="${build.home}/library/classes/org/apache/struts/resources"/>
+ <copy todir="${build.home}/library/classes/org/apache/struts/resources">
+ <fileset dir="src/conf" includes="**/*.dtd"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Create directories and copy files for documentation app -->
+ <target name="prepare.documentation">
+ <mkdir dir="${build.home}"/>
+ <mkdir dir="${build.home}/documentation"/>
+ <mkdir dir="${build.home}/documentation/dtds"/>
+ <copy todir="${build.home}/documentation/dtds">
+ <fileset dir="src/conf" includes="**/*.dtd"/>
+ </copy>
+ <mkdir dir="${build.home}/documentation/WEB-INF"/>
+ <mkdir dir="${build.home}/documentation/WEB-INF/classes"/>
+ <mkdir dir="${build.home}/documentation/WEB-INF/lib"/>
+ <copy todir="${build.home}/documentation">
+ <fileset dir="web/documentation"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Create directories and copy files for example application -->
+ <target name="prepare.example">
+ <mkdir dir="${build.home}"/>
+ <mkdir dir="${build.home}/example"/>
+ <mkdir dir="${build.home}/example/WEB-INF"/>
+ <mkdir dir="${build.home}/example/WEB-INF/classes"/>
+ <mkdir dir="${build.home}/example/WEB-INF/lib"/>
+ <copy todir="${build.home}/example">
+ <fileset dir="web/example"/>
+ </copy>
+ </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"/>
+ <copy todir="${build.home}/test">
+ <fileset dir="web/test"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Create directories and copy files for template example -->
+ <target name="prepare.template">
+ <mkdir dir="${build.home}"/>
+ <mkdir dir="${build.home}/template"/>
+ <mkdir dir="${build.home}/template/css"/>
+ <mkdir dir="${build.home}/template/graphics"/>
+ <mkdir dir="${build.home}/template/WEB-INF"/>
+ <mkdir dir="${build.home}/template/WEB-INF/lib"/>
+ <mkdir dir="${build.home}/template/WEB-INF/tlds"/>
+ <copy todir="${build.home}/template">
+ <fileset dir="web/template-example"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Create directories and copy files for upload example -->
+ <target name="prepare.upload">
+ <mkdir dir="${build.home}"/>
+ <mkdir dir="${build.home}/upload"/>
+ <mkdir dir="${build.home}/upload/WEB-INF"/>
+ <mkdir dir="${build.home}/upload/WEB-INF/lib"/>
+ <mkdir dir="${build.home}/upload/WEB-INF/classes"/>
+ <copy todir="${build.home}/upload">
+ <fileset dir="web/upload" />
+ </copy>
+ </target>
+
+ <!-- DIST: Create directories and copy files for distribution -->
+ <target name="prepare.dist">
+ <mkdir dir="${dist.home}"/>
+ <mkdir dir="${dist.home}/etc"/>
+ <mkdir dir="${dist.home}/lib"/>
+ <mkdir dir="${dist.home}/src"/>
+ <mkdir dir="${dist.home}/web"/>
+ <mkdir dir="${dist.home}/webapps"/>
+ </target>
+
+ <!-- BUILD: Compile library directory components -->
+ <target name="compile.library" depends="prepare.library">
+ <javac srcdir="src/share" destdir="${build.home}/library/classes"
+ classpath="${servlet.jar}"
+ debug="true" optimize="false" deprecation="false"/>
+ <copy todir="${build.home}/library/classes">
+ <fileset dir="src/share" includes="**/*.properties"/>
+ </copy>
+ <copy todir="${build.home}/library">
+ <fileset dir="src/conf" includes="*.dtd"/>
+ <fileset dir="src/conf" includes="*.tld"/>
+ </copy>
+ <style basedir="src/doc" destdir="${build.home}/library"
+ extension=".tld" style="stylesheets/tld.xsl"
+ includes="struts-*.xml"/>
+ <copy todir="${build.home}/library/classes/META-INF/tlds">
+ <fileset dir="${build.home}/library" includes="struts-*.tld"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Compile documentation application components -->
+ <target name="compile.documentation"
+ depends="dist.library,prepare.documentation">
+
+ <!-- Compile beans and tags required by the documentation app -->
+<!--
+ <javac srcdir="src/documentation"
+ destdir="${build.home}/documentation/WEB-INF/classes"
+ classpath="${build.home}/library/classes:${servlet.jar}"
+ debug="true" optimize="false" deprecation="false"/>
+-->
+
+ <!-- Copy Struts JAR file and TLDs to the documentation app -->
+ <copy file="${dist.home}/lib/${app.name}.jar"
+ tofile="${build.home}/documentation/WEB-INF/lib/${app.name}.jar"/>
+ <copy todir="${build.home}/documentation/WEB-INF">
+ <fileset dir="${dist.home}/lib" includes="*.tld"/>
+ </copy>
+
+ <!-- Copy static documentation content -->
+ <copy file="TODO" tofile="${build.home}/documentation/todo.txt"/>
+ <copy todir="${build.home}/documentation">
+ <fileset dir="web/documentation"/>
+ </copy>
+
+ <!-- Create dynamically generated documentation -->
+ <style basedir="src/doc" destdir="${build.home}/documentation"
+ extension=".html" style="stylesheets/struts.xsl" includes="*.xml"/>
+ <copy todir="${build.home}/documentation">
+ <fileset dir="src/doc">
+ <include name="**/*.css"/>
+ <include name="**/*.gif"/>
+ <include name="**/*.html"/>
+ <include name="**/*.jpg"/>
+ <include name="**/*.js"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- BUILD: Compile example application components -->
+ <target name="compile.example"
+ depends="dist.library,prepare.example">
+ <javac srcdir="src/example"
+ destdir="${build.home}/example/WEB-INF/classes"
+ classpath="${build.home}/library/classes:${servlet.jar}"
+ debug="true" optimize="false" deprecation="false"/>
+ <copy todir="${build.home}/example/WEB-INF/classes">
+ <fileset dir="src/example" includes="**/*.properties"/>
+ </copy>
+ <copy todir="${build.home}/example">
+ <fileset dir="web/example"/>
+ </copy>
+ <copy file="${dist.home}/lib/${app.name}.jar"
+ tofile="${build.home}/example/WEB-INF/lib/${app.name}.jar"/>
+ <copy todir="${build.home}/example/WEB-INF">
+ <fileset dir="${dist.home}/lib" includes="*.tld"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Compile template example application components -->
+ <target name="compile.template"
+ depends="dist.library,prepare.template">
+ <copy todir="${build.home}/template">
+ <fileset dir="web/template-example"/>
+ </copy>
+ <copy file="${dist.home}/lib/${app.name}.jar"
+ tofile="${build.home}/template/WEB-INF/lib/${app.name}.jar"/>
+ <copy todir="${build.home}/template/WEB-INF/tlds">
+ <fileset dir="${dist.home}/lib" includes="*.tld"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Compile upload example application components -->
+ <target name="compile.upload"
+ depends="dist.library,prepare.upload">
+
+ <javac srcdir="web/upload"
+ destdir="${build.home}/upload/WEB-INF/classes"
+ classpath="${build.home}/library/classes:${servlet.jar}"
+ debug="true" optimize="false" deprecation="false"/>
+ <copy todir="${build.home}/upload">
+ <fileset dir="web/upload" />
+ </copy>
+ <copy file="${dist.home}/lib/${app.name}.jar"
+ tofile="${build.home}/upload/WEB-INF/lib/${app.name}.jar"/>
+ <copy file="${dist.home}/lib/${app.name}-form.tld"
+ todir="${build.home}/upload/WEB-INF" />
+ </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"/>
+ <copy todir="${build.home}/test/WEB-INF/classes">
+ <fileset dir="src/test" includes="**/*.properties"/>
+ </copy>
+ <copy todir="${build.home}/test">
+ <fileset dir="web/test"/>
+ </copy>
+ <copy file="${dist.home}/lib/${app.name}.jar"
+ tofile="${build.home}/test/WEB-INF/lib/${app.name}.jar"/>
+ <copy todir="${build.home}/test/WEB-INF">
+ <fileset dir="${dist.home}/lib" includes="*.tld"/>
+ </copy>
+ </target>
+
+ <!-- BUILD: Create Javadoc documentation -->
+ <target name="compile.javadoc">
+ <delete dir="${build.home}/documentation/api"/>
+ <mkdir dir="${build.home}/documentation/api"/>
+ <javadoc sourcepath="src/share"
+ destdir="${build.home}/documentation/api"
+ packagenames="org.apache.struts.*"
+ author="true"
+ private="true"
+ version="true"
+ windowtitle="Apache Struts API Documentation"
+ doctitle="<h1>Apache Struts Framework</h1>"
+ bottom="Copyright © 2000 - Apache Software Foundation"/>
+ </target>
+
+ <!-- DIST: Construct library distributables -->
+ <target name="dist.library" depends="prepare.dist,compile.library">
+ <copy todir="${dist.home}/lib">
+ <fileset dir="${build.home}/library" includes="*.dtd"/>
+ <fileset dir="${build.home}/library" includes="*.tld"/>
+ </copy>
+ <jar jarfile="${dist.home}/lib/${app.name}.jar"
+ manifest="src/conf/MANIFEST.MF"
+ basedir="${build.home}/library/classes" includes="**"/>
+ </target>
+
+ <!-- DIST: Construct documentation distributables -->
+ <target name="dist.documentation"
+ depends="dist.library,compile.documentation,compile.javadoc">
+ <jar jarfile="${dist.home}/webapps/${app.name}-documentation.war"
+ basedir="${build.home}/documentation" includes="**"/>
+ </target>
+
+ <!-- DIST: Construct example distributables -->
+ <target name="dist.example" depends="dist.library,compile.example">
+ <jar jarfile="${dist.home}/webapps/${app.name}-example.war"
+ basedir="${build.home}/example" includes="**"/>
+ </target>
+
+ <!-- DIST: Construct template example distributables -->
+ <target name="dist.template" depends="dist.library,compile.template">
+ <jar jarfile="${dist.home}/webapps/${app.name}-template.war"
+ basedir="${build.home}/template" includes="**"/>
+ </target>
+
+ <!-- DIST: Construct upload example distributables -->
+ <target name="dist.upload" depends="dist.library,compile.upload">
+ <jar jarfile="${dist.home}/webapps/${app.name}-upload.war"
+ basedir="${build.home}/upload" 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">
+ <copy todir="${dist.home}/etc">
+ <fileset dir="." includes="build.*"/>
+ </copy>
+ <copy file="INSTALL" tofile="${dist.home}/INSTALL"/>
+ <copy file="LICENSE" tofile="${dist.home}/LICENSE"/>
+ <copy file="README" tofile="${dist.home}/README"/>
+ <copy file="TODO" tofile="${dist.home}/TODO"/>
+ <copy todir="${dist.home}/src">
+ <fileset dir="src"/>
+ </copy>
+ <copy todir="${dist.home}/web">
+ <fileset dir="web"/>
+ </copy>
+ </target>
+
+ <!-- DIST: Construct complete release distribution -->
+ <target name="dist"
+ depends="dist.library,dist.documentation,dist.example,dist.template,dist.upload,dist.test,dist.source"/>
+
+ <!-- DEPLOY: Deploy these applications on Catalina -->
+ <target name="deploy.catalina" depends="compile.documentation,compile.example,compile.template,compile.upload,compile.test">
+ <mkdir dir="${catalina.home}/webapps/struts-documentation"/>
+ <copy todir="${catalina.home}/webapps/struts-documentation">
+ <fileset dir="${build.home}/documentation"/>
+ </copy>
+ <mkdir dir="${catalina.home}/webapps/struts-example"/>
+ <copy todir="${catalina.home}/webapps/struts-example">
+ <fileset dir="${build.home}/example"/>
+ </copy>
+ <mkdir dir="${catalina.home}/webapps/struts-template"/>
+ <copy todir="${catalina.home}/webapps/struts-template">
+ <fileset dir="${build.home}/template"/>
+ </copy>
+ <mkdir dir="${catalina.home}/webapps/struts-test"/>
+ <copy todir="${catalina.home}/webapps/struts-test">
+ <fileset dir="${build.home}/test"/>
+ </copy>
+ </target>
+
+ <!-- DEPLOY: Deploy these applications on Tomcat -->
+ <target name="deploy.tomcat" depends="compile.documentation,compile.example,compile.template,compile.upload,compile.test">
+ <mkdir dir="${tomcat.home}/webapps/struts-documentation"/>
+ <copy todir="${tomcat.home}/webapps/struts-documentation">
+ <fileset dir="${build.home}/documentation"/>
+ </copy>
+ <mkdir dir="${tomcat.home}/webapps/struts-example"/>
+ <copy todir="${tomcat.home}/webapps/struts-example">
+ <fileset dir="${build.home}/example"/>
+ </copy>
+ <mkdir dir="${tomcat.home}/webapps/struts-template"/>
+ <copy todir="${tomcat.home}/webapps/struts-template">
+ <fileset dir="${build.home}/template"/>
+ </copy>
+ <mkdir dir="${tomcat.home}/webapps/struts-test"/>
+ <copy todir="${tomcat.home}/webapps/struts-test">
+ <fileset dir="${build.home}/test"/>
+ </copy>
+ </target>
+
+ <!-- UTILITY: Display all targets intended for developer use -->
+ <target name="targets">
+ <echo message=""/>
+ <echo message="ANT build for ${project.name} ${project.version}"/>
+ <echo message=""/>
+ <echo message="The following targets are available:"/>
+ <echo message=" all Cleans and builds library and webapps"/>
+ <echo message=" clean Cleans the build and distribution directories"/>
+ <echo message=" compile.documentation Builds the documentation webapp"/>
+ <echo message=" compile.examples Builds the examples webapp"/>
+ <echo message=" compile.javadoc Builds Javadoc API docs for Struts"/>
+ <echo message=" compile.library Builds the main packages"/>
+ <echo message=" compile.template Builds the template example webapp"/>
+ <echo message=" compile.upload Builds the upload example webapp"/>
+ <echo message=" compile.test Builds the tests webapp"/>
+ <echo message=" deploy.catalina Deploys build to Catalina build directory"/>
+ <echo message=" deploy.tomcat Depoys build to Tomcat build directory"/>
+ <echo message=" dist Builds binary distribution in dist directory"/>
+ <echo message=""/>
+ <echo message="Default target is 'compile.library'"/>
+ </target>
+
+ <!-- UTILITY: Clean up build and distribution directories -->
+ <target name="clean">
+ <delete dir="${build.home}"/>
+ <delete dir="${dist.home}"/>
+ </target>
+
+ <!-- UTILITY: All-in-one build target -->
+ <target name="all"
+ depends="clean,compile.library,compile.documentation,compile.example,compile.test"/>
+
+</project>
1.4 +5 -5 jakarta-struts/src/share/org/apache/struts/taglib/form/SubmitTag.java
Index: SubmitTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/SubmitTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SubmitTag.java 2000/11/18 20:04:49 1.3
+++ SubmitTag.java 2000/12/19 19:23:02 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/SubmitTag.java,v 1.3 2000/11/18 20:04:49 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2000/11/18 20:04:49 $
+ * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/SubmitTag.java,v 1.4 2000/12/19 19:23:02 mschachter Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/12/19 19:23:02 $
*
* ====================================================================
*
@@ -76,7 +76,7 @@
* Tag for input fields of type "submit".
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2000/11/18 20:04:49 $
+ * @version $Revision: 1.4 $ $Date: 2000/12/19 19:23:02 $
*/
public class SubmitTag extends BaseHandlerTag {
@@ -123,7 +123,7 @@
* @param property The property name
*/
public void setProperty(String property) {
-
+
this.property = property;
}
1.1 jakarta-struts/web/upload/display.jsp
Index: display.jsp
===================================================================
<%@ page language="java" %>
<b>The Text</b>: <%= request.getAttribute("text") %> <br />
<b>The File name</b>: <%= request.getAttribute("fileName") %> <br />
<b>The File content type</b>: <%= request.getAttribute("contentType") %> <br />
<b>The File size</b>: <%= request.getAttribute("size") %> <br />
<b>The File data</b>: <br />
<hr />
<pre><%= request.getAttribute("data") %></pre>
<hr />
1.1 jakarta-struts/web/upload/upload.jsp
Index: upload.jsp
===================================================================
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
<!--
The most important part is to declare your form's enctype to be "multipart/form-data",
and to have a form:file element that maps to your ActionForm's FormFile property
-->
<form:form action="upload.do" enctype="multipart/form-data">
Please enter some text, just to demonstrate the handling of text elements as opposed to file elements:<br />
<form:text property="theText" /><br /><br />
Please select the file that you would like to upload:<br />
<form:file property="theFile" /><br /><br />
<form:submit />
</form:form>
1.1 jakarta-struts/web/upload/WEB-INF/struts-config.xml
Index: struts-config.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<form-beans>
<form-bean name="uploadForm"
type="org.apache.struts.example.upload.UploadForm"/>
</form-beans>
<action-mappings>
<!-- Upload Action -->
<action path="/upload"
type="org.apache.struts.example.upload.UploadAction"
name="uploadForm">
<forward name="display" path="/display.jsp" />
</action>
</action-mappings>
</struts-config>
1.1 jakarta-struts/web/upload/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>
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>upload.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/WEB-INF/struts-form.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-form.tld</taglib-location>
</taglib>
</web-app>
1.1 jakarta-struts/web/upload/WEB-INF/classes/org/apache/struts/example/upload/UploadAction.java
Index: UploadAction.java
===================================================================
package org.apache.struts.example.upload;
import java.io.IOException;
import java.io.FileNotFoundException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.upload.FormFile;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ForwardingActionForward;
/**
* This class takes the UploadForm and retrieves the text value
* and file attributes and puts them in the request for the display.jsp
* page to display them
*
* @author Mike Schachter
*/
public class UploadAction extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
if (form instanceof UploadForm) {
UploadForm theForm = (UploadForm) form;
//retrieve the text data
String text = theForm.getTheText();
//retrieve the file representation
FormFile file = theForm.getTheFile();
//retrieve the file name
String fileName= file.getFileName();
//retrieve the content type
String contentType = file.getContentType();
//retrieve the file size
String size = (file.getFileSize() + " bytes");
String data = null;
try {
//retrieve the file data
data = new String(file.getFileData());
}
catch (FileNotFoundException fnfe) {
return null;
}
catch (IOException ioe) {
return null;
}
//place the data into the request for retrieval from display.jsp
request.setAttribute("text", text);
request.setAttribute("fileName", fileName);
request.setAttribute("contentType", contentType);
request.setAttribute("size", size);
request.setAttribute("data", data);
//destroy the temporary file created
file.destroy();
//return a forward to display.jsp
return mapping.findForward("display");
}
//this shouldn't happen in this example
return null;
}
}
1.1 jakarta-struts/web/upload/WEB-INF/classes/org/apache/struts/example/upload/UploadForm.java
Index: UploadForm.java
===================================================================
package org.apache.struts.example.upload;
import org.apache.struts.upload.FormFile;
import org.apache.struts.action.ActionForm;
/**
* This class is a placeholder for form values. In a multipart request, files are represented by
* set and get methods that use the class org.apache.struts.upload.FormFile, an interface with
* basic methods to retrieve file information. The actual structure of the FormFile is dependant
* on the underlying impelementation of multipart request handling. The default implementation
* that struts uses is org.apache.struts.upload.DiskMultipartRequestHandler.
*
* @author Mike Schachter
*/
public class UploadForm extends ActionForm {
/**
* The value of the text the user has sent as form data
*/
protected String theText;
/**
* The file that the user has uploaded
*/
protected FormFile theFile;
/**
* Retrieve the value of the text the user has sent as form data
*/
public String getTheText() {
return theText;
}
/**
* Set the value of the form data text
*/
public void setTheText(String theText) {
this.theText = theText;
}
/**
* Retrieve a representation of the file the user has uploaded
*/
public FormFile getTheFile() {
return theFile;
}
/**
* Set a representation of the file the user has uploaded
*/
public void setTheFile(FormFile theFile) {
this.theFile = theFile;
}
}