Hi Jon, I am having a little problem with the solution you gave me. The problem is that, unlike the <jspc> tag which uses org.apache.jasper.JspC, I cannot include nested <fileset> tags to specifically indicate which jsps to compile and which not to (i.e. I have a header/footer jsp included in alot of other jsps in which the converted java code won't compile as a stand-alone)
The <jsp> tag allowed me to do this but doesn't allow the webXmlFragment attribute (which puzzles me since it also is org.apache.jasper.JspC). I suppose there are other options like re-arranging my directory structure, building my own java class/task, etc, but that all seems kind of extreme. Any ideas? Thanks, Tony --- Jon Eaves <[EMAIL PROTECTED]> wrote: > Hi Tony, > > Here's an Ant task that will do what you want. > Please be aware > that this will delete all the JSP files from the > build directory > as part of the processing. > > It also creates a web.xml fragment that represents > all the > servlets (that were the jsp files) that needs to be > included > in the web.xml prior to creating the WAR file. > > It runs jasper first, and expects to find the JSP > files in > ${web.home} and will output the java files in > ${basedir}/gensrc. > > These java files are then compiled and put into the > build > directory (where all the servlet files are) > > <!-- ==== jspc target ==== --> > <taskdef classname="org.apache.jasper.JspC" > name="jasper" > > <classpath refid="compile.classpath" /> > </taskdef> > > <target name="jspc" depends="compile" > description="Invoke Jasper JSP compiler" > > <mkdir dir="${basedir}/gensrc" /> > > <jasper verbose="0" > uriroot="${web.home}" > webXmlFragment="${basedir}/web.inc" > outputDir="${basedir}/gensrc" /> > > <javac > srcdir="${basedir}/gensrc" > destdir="${build.home}/WEB-INF/classes" > > <classpath refid="compile.classpath" /> > </javac> > > <!-- remove any *.jsp files in the build > directory --> > <delete> > <fileset dir="${build.home}" > includes="**/*.jsp" /> > </delete> > > </target> > > Now, just WAR it up. > > <target name="dist" depends="compile,javadoc" > description="Create binary distribution"> > > <!-- Copy documentation subdirectories --> > <mkdir dir="${dist.home}/docs"/> > <copy todir="${dist.home}/docs"> > <fileset dir="${docs.home}"/> > </copy> > > <!-- Create application JAR file --> > <jar > jarfile="${dist.home}/${app.name}-${app.version}.war" > basedir="${build.home}"/> > > <!-- Copy additional files to ${dist.home} as > necessary --> > > </target> > > So, this creates the war file. > > ant compile jspc dist > > Will do all the good things. If you want the actual > build.xml > that does all this, then let me know. If you're > using an IDE > this should give you the general idea, but you're on > your own. > > Cheers, > -- jon > > > Tony Colson wrote: > > After reading the documentation I am unclear how > to > > package the precompiled jsp pages with a war file > so > > that Tomcat will see and use them. > > > > Also, do I need to include the actual jsp files > > themselves? When I tried that, Tomcat recompiled > them > > anyways and put them in the work directory as > normal. > > > > I am running Tomcat 4.1.18. > > > > Thanks > > Tony > > > > __________________________________________________ > > Do you Yahoo!? > > Yahoo! Mail Plus - Powerful. Affordable. Sign up > now. > > http://mailplus.yahoo.com > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > -- > Jon Eaves <[EMAIL PROTECTED]> > http://www.eaves.org/jon/ > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>