craigmcc 01/02/12 15:59:43
Modified: . build.xml
Added: web/blank index.jsp
web/blank/WEB-INF struts-config.xml web.xml
web/blank/WEB-INF/classes ApplicationResources.properties
Log:
Add the "struts-blank" starter application (contributed by Ted Husted) to
the Struts build process. It will now show up as file "struts-blank.war"
in the Struts binary distribution.
Revision Changes Path
1.36 +59 -9 jakarta-struts/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/build.xml,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- build.xml 2001/02/02 00:18:11 1.35
+++ build.xml 2001/02/12 23:59:37 1.36
@@ -30,6 +30,18 @@
</copy>
</target>
+ <!-- BUILD: Create directories and copy files for blank application -->
+ <target name="prepare.blank">
+ <mkdir dir="${build.home}"/>
+ <mkdir dir="${build.home}/blank"/>
+ <mkdir dir="${build.home}/blank/WEB-INF"/>
+ <mkdir dir="${build.home}/blank/WEB-INF/classes"/>
+ <mkdir dir="${build.home}/blank/WEB-INF/lib"/>
+ <copy todir="${build.home}/blank">
+ <fileset dir="web/blank"/>
+ </copy>
+ </target>
+
<!-- BUILD: Create directories and copy files for documentation app -->
<target name="prepare.documentation">
<mkdir dir="${build.home}"/>
@@ -130,6 +142,29 @@
</copy>
</target>
+ <!-- BUILD: Compile blank application components -->
+ <target name="compile.blank"
+ depends="dist.library,prepare.blank">
+<!--
+ <javac srcdir="src/blank"
+ destdir="${build.home}/blank/WEB-INF/classes"
+ classpath="${build.home}/library/classes:${servlet.jar}"
+ debug="${debug}" optimize="${optimize}"
+ deprecation="${deprecation}"/>
+ <copy todir="${build.home}/blank/WEB-INF/classes">
+ <fileset dir="src/blank" includes="**/*.properties"/>
+ </copy>
+-->
+ <copy todir="${build.home}/blank">
+ <fileset dir="web/blank"/>
+ </copy>
+ <copy file="${dist.home}/lib/${app.name}.jar"
+ tofile="${build.home}/blank/WEB-INF/lib/${app.name}.jar"/>
+ <copy todir="${build.home}/blank/WEB-INF">
+ <fileset dir="${dist.home}/lib" includes="*.tld"/>
+ </copy>
+ </target>
+
<!-- BUILD: Compile documentation application components -->
<target name="compile.documentation"
depends="dist.library,prepare.documentation">
@@ -284,6 +319,12 @@
basedir="${build.home}/library/classes" includes="**"/>
</target>
+ <!-- DIST: Construct blank distributables -->
+ <target name="dist.blank" depends="dist.library,compile.blank">
+ <jar jarfile="${dist.home}/webapps/${app.name}-blank.war"
+ basedir="${build.home}/blank" includes="**"/>
+ </target>
+
<!-- DIST: Construct documentation distributables -->
<target name="dist.documentation"
depends="dist.library,compile.documentation,compile.javadoc">
@@ -303,18 +344,18 @@
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: 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: Copy sources -->
<target name="dist.source" depends="prepare.dist">
<copy todir="${dist.home}/etc">
@@ -333,10 +374,14 @@
<!-- DIST: Construct complete release distribution -->
<target name="dist"
-
depends="dist.library,dist.documentation,dist.example,dist.template,dist.upload,dist.test,dist.source"/>
+
depends="dist.library,dist.blank,dist.documentation,dist.example,dist.template,dist.test,dist.upload,dist.source"/>
<!-- DEPLOY: Deploy these applications on Catalina -->
- <target name="deploy.catalina"
depends="compile.documentation,compile.example,compile.template,compile.upload,compile.test">
+ <target name="deploy.catalina"
depends="compile.blank,compile.documentation,compile.example,compile.template,compile.test,compile.upload">
+ <mkdir dir="${catalina.home}/webapps/struts-blank"/>
+ <copy todir="${catalina.home}/webapps/struts-blank">
+ <fileset dir="${build.home}/blank"/>
+ </copy>
<mkdir dir="${catalina.home}/webapps/struts-documentation"/>
<copy todir="${catalina.home}/webapps/struts-documentation">
<fileset dir="${build.home}/documentation"/>
@@ -360,7 +405,11 @@
</target>
<!-- DEPLOY: Deploy these applications on Tomcat -->
- <target name="deploy.tomcat"
depends="compile.documentation,compile.example,compile.template,compile.upload,compile.test">
+ <target name="deploy.tomcat"
depends="compile.blank,compile.documentation,compile.example,compile.template,compile.test,compile.upload">
+ <mkdir dir="${tomcat.home}/webapps/struts-blank"/>
+ <copy todir="${tomcat.home}/webapps/struts-blank">
+ <fileset dir="${build.home}/blank"/>
+ </copy>
<mkdir dir="${tomcat.home}/webapps/struts-documentation"/>
<copy todir="${tomcat.home}/webapps/struts-documentation">
<fileset dir="${build.home}/documentation"/>
@@ -391,6 +440,7 @@
<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.blank Builds the blank starter app"/>
<echo message=" compile.documentation Builds the documentation webapp"/>
<echo message=" compile.example Builds the examples webapp"/>
<echo message=" compile.javadoc Builds Javadoc API docs for Struts"/>
1.1 jakarta-struts/web/blank/index.jsp
Index: index.jsp
===================================================================
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
<font color="red">
ERROR: Application resources not loaded -- check servlet container
logs for error messages.
</font>
</logic:notPresent>
<h3><bean:message key="index.heading"/></h3>
<p><bean:message key="index.message"/></p>
</body>
</html:html>
1.1 jakarta-struts/web/blank/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">
<!--
This is a blank Struts configuration file based on the example application,
with commented examples of some items.
NOTE: If you have a generator tool to create the corresponding Java classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with the
corresponding "name" and "type" attributes, as shown here.
-->
<struts-config>
<!-- ========== Data Source Configuration =============================== -->
<!--
<data-sources>
<data-source
autoCommit="false"
description="Example Data Source Configuration"
driverClass="org.postgresql.Driver"
maxCount="4"
minCount="2"
password="mypassword"
url="jdbc:postgresql://localhost/mydatabase"
user="myusername"
/>
</data-sources>
-->
<!-- ========== Form Bean Definitions =================================== -->
<form-beans>
<!-- Example logon form bean
<form-bean name="logonForm"
type="org.apache.struts.example.LogonForm"/>
-->
</form-beans>
<!-- ========== Global Forward Definitions ============================== -->
<global-forwards>
<!-- Example logon forward
<forward name="logon" path="/logon.jsp"/>
-->
</global-forwards>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
<!-- Example logon action
<action path="/logon"
type="org.apache.struts.example.LogonAction"
name="logonForm"
scope="request"
input="/logon.jsp">
</action>
-->
<!-- Example logoff action
<action path="/logoff"
type="org.apache.struts.example.LogoffAction">
<forward name="success" path="/index.jsp"/>
</action>
-->
<!-- The standard administrative actions available with Struts -->
<!-- These would be either omitted or protected by security -->
<!-- in a real application deployment -->
<action path="/admin/addFormBean"
type="org.apache.struts.actions.AddFormBeanAction"/>
<action path="/admin/addForward"
type="org.apache.struts.actions.AddForwardAction"/>
<action path="/admin/addMapping"
type="org.apache.struts.actions.AddMappingAction"/>
<action path="/admin/reload"
type="org.apache.struts.actions.ReloadAction"/>
<action path="/admin/removeFormBean"
type="org.apache.struts.actions.RemoveFormBeanAction"/>
<action path="/admin/removeForward"
type="org.apache.struts.actions.RemoveForwardAction"/>
<action path="/admin/removeMapping"
type="org.apache.struts.actions.RemoveMappingAction"/>
</action-mappings>
</struts-config>
1.1 jakarta-struts/web/blank/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>
<!-- Example Database Initialization Servlet Configuration
<servlet>
<servlet-name>database</servlet-name>
<servlet-class>org.apache.struts.example.DatabaseServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
-->
<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<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>2</load-on-startup>
</servlet>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Example Application Tag Library Descriptor
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>
-->
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>
1.1
jakarta-struts/web/blank/WEB-INF/classes/ApplicationResources.properties
Index: ApplicationResources.properties
===================================================================
index.title=Struts Blank Application
index.heading=Hello World!
index.message=To get started on your own application, rename struts-blank.war to the
name for your application, and let your container auto-deploy it. Edit the blank
configuration files as needed, and you are on your way! (You can find the
ApplicationResources file with this message in the classes folder.)