geirm 01/04/15 20:26:26
Added: contrib/temporary/struts-velocity README.txt build.xml
Log:
first bits for the struts-velocity package...
Revision Changes Path
1.1 jakarta-velocity/contrib/temporary/struts-velocity/README.txt
Index: README.txt
===================================================================
Welcome to the Struts-Velocity Experiment!
==========================================
NOTE : This is unsupported, experimental software, suitable
for *no* real use whatsoever. It is intended as an exploration
of the incorporation of Velocity templates in the Struts
framework.
--------------------------------------------------------
This package is an exploration of using the Velocity template
engine in the Struts framework.
This package allows you to :
1) Use velocity templates named XXXXX.vm anywhere you would
use a JSP in your Struts application.
2) You may intermingle - having some pages in Velocity, and
some in JSP
Currently, framework support is limited to :
- the <bean:message tag via $message.get( key ) for the message
resource manager
- the <html:errors tag via $errors.getErrors() for the
ActionErrors
The current implementation is more or less a hack, and they
will be changed. More will be converted if interest warrants.
Example
-------
Currently, the struts-example has been converted to work
with Velocity templates rather than JSP, and the example
works for the most part. (There may be a bug or two...)
This example, as a WAR, has been tested with Tomcat 4.0 and
Tomcat 3.2.1. It can be found here :
http://jakarta.apache.org/builds/jakarta-velocity/contrib/struts/
To use :
1) drop the war into your webapps directory
2) restart tomcat
3) aim your browser at
http://localhost:8080/struts-velocity-example/
That's all there is to it.
Building
--------
Building the code is easy :
1) You must have ant installed, in your path, and ANT_HOME set correctly.
This keeps this distro small.
2) Change the properties in build.xml to reflect the locations of your
servlet.jar, struts.jar and velocity.jar. You should also be able
to use a build.properties file to override w/o having to change
build.xml. Your call...
3) type "ant jar" at the prompt, and it should build.
1.1 jakarta-velocity/contrib/temporary/struts-velocity/build.xml
Index: build.xml
===================================================================
<project name="Velocity-Struts" default="compile" basedir=".">
<!--
Support for Velocity templates in the Jakarta Struts framework
$Id: build.xml,v 1.1 2001/04/16 03:26:26 geirm Exp $
-->
<!-- ========== Initialize Properties ===================================== -->
<property file="build/build.properties"/> <!-- Component local -->
<property file="../build.properties"/> <!-- Commons local -->
<property file="${user.home}/.build.properties"/> <!-- User local -->
<!-- ========== External Dependencies ===================================== -->
<!-- The directory containing your struts jar -->
<property name="struts.home"
value="/home/gmj/jakarta/jakarta-struts/dist/lib/"/>
<!-- The directory containing your servlet jar -->
<property name="servlet.home"
value="/home/gmj/jakarta/jakarta-servletapi-4/lib/"/>
<!-- The directory containing your servlet jar -->
<property name="velocity.home"
value="/home/gmj/velocity/jakarta-velocity/bin/"/>
<!-- ========== Derived Values ============================================ -->
<!-- The pathname of the "struts.jar" JAR file -->
<property name="struts.jar" value="${struts.home}/struts.jar"/>
<!-- The pathname of the "servlet.jar" JAR file -->
<property name="servlet.jar" value="${servlet.home}/servlet.jar"/>
<!-- The pathname of the "velocity.jar" JAR file -->
<property name="velocity.jar"
value="${velocity.home}/velocity-1.1-dev.jar"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="project.name" value="struts-velocity"/>
<!-- The title of this component -->
<property name="project.title" value="Velocity Support for Jakarta
Struts"/>
<!-- The current version number of this component -->
<property name="project.version" value="0.01-dev"/>
<!-- The base directory for compilation targets -->
<property name="build.home" value="target"/>
<!-- The base directory for component configuration files -->
<property name="conf.home" value="src/conf"/>
<!-- The base directory for distribution targets -->
<property name="dist.home" value="dist"/>
<!-- The base directory for component sources -->
<property name="source.home" value="src/java"/>
<!-- ========== Compiler Defaults ========================================= -->
<!-- Should Java compilations set the 'debug' compiler option? -->
<property name="compile.debug" value="true"/>
<!-- Should Java compilations set the 'deprecation' compiler option? -->
<property name="compile.deprecation" value="true"/>
<!-- Should Java compilations set the 'optimize' compiler option? -->
<property name="compile.optimize" value="true"/>
<!-- Construct compile classpath -->
<path id="compile.classpath">
<pathelement location="${build.home}/classes"/>
<pathelement location="${struts.jar}"/>
<pathelement location="${servlet.jar}"/>
<pathelement location="${velocity.jar}"/>
</path>
<!-- ========== Executable Targets ======================================== -->
<target name="init"
description="Initialize and evaluate conditionals">
<echo message="-------- ${project.name} ${project.version} --------"/>
<filter token="name" value="${project.name}"/>
<filter token="version" value="${project.version}"/>
</target>
<target name="prepare" depends="init"
description="Prepare build directory">
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
<mkdir dir="${build.home}/conf"/>
<mkdir dir="${build.home}/javadoc"/>
</target>
<target name="static" depends="prepare"
description="Copy static files to build directory">
<tstamp/>
<copy todir="${build.home}/conf" filtering="on">
<fileset dir="${conf.home}" includes="*.MF"/>
</copy>
</target>
<target name="compile" depends="static"
description="Compile">
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${build.home}/classes" filtering="on">
<fileset dir="${source.home}" excludes="**/*.java"/>
</copy>
</target>
<target name="clean"
description="Clean build and distribution directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
</target>
<target name="all" depends="clean,compile"
description="Clean and compile all components"/>
<target name="javadoc" depends="compile"
description="Create Javadoc documentation">
<javadoc sourcepath="${source.home}"
destdir="${build.home}/javadoc"
packagenames="org.apache.velocity.struts.*"
author="true"
private="true"
version="true"
doctitle="<h1>${project.title}</h1>"
windowtitle="${project.title} (Version ${project.version})"
bottom="Copyright (c) 2001 - Apache Software Foundation" >
<classpath refid="compile.classpath"/>
</javadoc>
</target>
<target name="jar" depends="compile">
<jar jarfile="${project.name}-${project.version}.jar"
basedir="${build.home}/classes"
manifest="${conf.home}/MANIFEST.MF"/>
</target>
<target name="dist" depends="compile,javadoc"
description="Create binary distribution">
<!-- TODO: top level files like LICENSE and README -->
<mkdir dir="${dist.home}"/>
<mkdir dir="${dist.home}/conf"/>
<copy todir="${dist.home}/conf">
<fileset dir="${build.home}/conf"/>
</copy>
<mkdir dir="${dist.home}/lib"/>
<jar jarfile="${dist.home}/lib/${project.name}.jar"
basedir="${build.home}/classes"
manifest="${build.home}/conf/MANIFEST.MF"/>
<mkdir dir="${dist.home}/src"/>
<copy todir="${dist.home}/src" filtering="on">
<fileset dir="${source.home}"/>
</copy>
</target>
</project>