Thanks Jake and all! I tried the way you said.. I have added another arg webxml. The good news is its updating web.xml file... only thing is it is adding an extra "." infront of the class file and name! So the page is not displayed. If I remove the . and war.. thats fine.

Thats the problem. Can you pl. help with this. I am attaching the web.xml generated and build.xml.

Best regards,
Ashuthosh

On Sat, 07 Dec 2002 Jacob Kjome wrote :

Here's something I copied from an ant-user message a while ago. Haven't tried it, though. Maybe it will help....


<property name="build.compiler" value="jikes"/>
<path id="compile.classpath">
<pathelement location="${java.home}/jre/lib/rt.jar"/>
<pathelement location="${java.home}/lib/tools.jar"/>
<pathelement location="${tomcat.lib}/jasper-compiler.jar"/>
<pathelement location="${tomcat.lib}/jasper-runtime.jar"/>
<pathelement location="${tomcat.common.lib}/xerces.jar"/>
<pathelement location="${tomcat.common.lib}/servlet.jar"/>
...
</path>
<!-- store the generated java classes here -->
<property name="generated.java.classes.dir" value="/some/path" />
<!-- generate java classes for you JSPs and mapping web.xml -->
<java
classname="org.apache.jasper.JspC"
classpath="${compile.classpath}"
fork="true"
failonerror="true">
<arg value="-d" />
<arg value="${generated.java.classes.dir}" />
<arg value="-webinc" />
<arg value="/path/to/the/generated/web.xml" />
<arg value="-webapp" />
<arg value="/path/to/you/webapp/dir" />
<jvmarg
value="-Djava.endorsed.dirs=${tomcat.home}/bin:${tomcat.home}/common/endorse
d" />
<jvmarg value="-Djasper.home=${tomcat.home}" />
<jvmarg value="-Xms194m" />
<jvmarg value="-Xmx194m" />
</java>
<!-- compile generated java classes and store them in their finall location
-->
<javac
srcdir="${generated.java.classes.dir}"
destdir="/path/to/you/webapp/dir/WEB-INF/classes"
optimize="off"
debug="on"
depend="on"
classpath="${compile.classpath}"
includeJavaRuntime="on"/>


Jake


At 11:48 AM 12/7/2002 +0000, you wrote:
Greetings!

Has any one tried jspc and webapp? I want to precomile jsps and write the servlet-mapping into web.xml. How can I use the above for this purpose.

I am working with ant1.5.1 and jboss+tomcat as my appserver.

Thanks in advance.






--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd";>
<!--
Automatically created by Tomcat JspC.
-->
<web-app>


	<servlet>
		<servlet-name>.AHome</servlet-name>
		<servlet-class>.AHome</servlet-class>
	</servlet>

	<servlet>
		<servlet-name>.Home</servlet-name>
		<servlet-class>.Home</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>.AHome</servlet-name>
		<url-pattern>/jsp/AHome.jsp</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>.Home</servlet-name>
		<url-pattern>/jsp/Home.jsp</url-pattern>
	</servlet-mapping>

</web-app>

<project name="MyProject" default="clean" basedir=".">
	<!-- set global properties for this build -->
    <property name="tomcat.home" value="d:\jakarta-tomcat-4.1.12"/>
    <property name="src" value="../src"/>
    <property name="build" value="../build"/>
	<property name="class" value="${build}/WEB-INF/classes"/>
    <property name="WEB-INF"  value="../WEB-INF"/>
	<property name="jars" value="${WEB-INF}/lib"/>
    <property name="dist"  value="../dist"/>
    <property name="html"  value="../html"/>
    <property name="jsp"  value="../jsp"/>		
     <target name="prepareall" >
        <delete dir="${build}"/>
		<delete dir="${src}/jsp"/>
		<!-- Creating Directories -->
		<mkdir dir="${build}/html"/>
		<mkdir dir="${build}/WEB-INF"/>
		<mkdir dir="${build}/WEB-INF/classes"/>
		<!-- mkdir dir="${build}/jsp"/ -->
		<mkdir dir="${dist}/lib"/>
		<mkdir dir="${src}/jsp"/>
		<!-- Copying a directory to another directory  -->
		<copy todir="${build}/html">			<fileset dir="${html}"/>   		</copy>
		<copy todir="${build}/WEB-INF">			<fileset dir="${WEB-INF}"/>    	</copy>
		<!-- copy todir="${build}/jsp">			<fileset dir="${jsp}"/>		</copy-->
		<!-- Compile the jsp into servlets -->
		
		<!-- jspc webinc="${build}/WEB-INF/webinc.xml" webxml="${build}/WEB-INF/web.xml" destdir="${src}/jsp" srcdir="${jsp}" verbose="9">
			<webapp basedir="${build}"/>
		</jspc -->
		
		<java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
		  <arg value="-d" />
		  <arg value="${src}/jsp" />
		  <arg value="-webxml" />
		  <arg value="f:\development\testjspc\build\WEB-INF\web.xml" />
		  <arg value="-webapp" />
		  <arg value="f:\development\testjspc" />
	      <jvmarg value="-Djava.endorsed.dirs=${tomcat.home}/bin:${tomcat.home}/common/endorsed" />
		  <jvmarg value="-Djasper.home=${tomcat.home}" />
		  <jvmarg value="-Xms194m" />
		  <jvmarg value="-Xmx194m" />
		</java>
		<!-- Compile the jsp code from ${src}/java into ${build} -->
		<javac srcdir="${src}/jsp" destdir="${class}" >
			 <classpath>
				<pathelement path="${class};${jars}/struts.jar;"/>
			 </classpath>
		</javac>
		<!-- Compile the java code from ${src}/java into ${build} -->
		<javac srcdir="${src}/java" destdir="${class}" >
			 <classpath>
				<pathelement path="${class};${jars}/struts.jar;"/>
			 </classpath>
		</javac>
    </target>
	<target name="preparewar" depends="prepareall">
		<!-- update="true" webxml="${build}/WEB-INF/web.xml"  -->
        <war update="true" webxml="${build}/WEB-INF/web.xml"  destfile="${dist}/lib/testjspc.war" basedir="${build}"/>
	</target>
    <target name="deploy" depends="preparewar">
         <copy file="${dist}/lib/testjspc.war" todir="f:\jboss-3.0.4_tomcat-4.0.6\server\default\deploy"/>
    </target>
    <target name="clean" depends="deploy">
	<!-- Delete the ${build} and ${dist} directory trees	 -->
         <!-- delete dir="${build}"/ -->
         <delete dir="${dist}"/> 
    </target>
</project>
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to