Cal VA
Weblog  
 
January 2130
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
<Dec Today Feb>
Search
Topics
Personal Personal
Java Java
Syndicate
Links
Referrers Today
   
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
   
 
 
 
 
 
God Bless America
 
Monday, May 24, 2004 - 2138 hrs

First number 2 - i do not have that problem. And i have pretty complex struts app. Does the precompile posted work? Second number 1 - here is my web.xml ServletRedirector org.apache.cactus.server.ServletTestRedirector ServeImage com.holmansite.util.ServeImage log4j-init com.holmansite.util.InitLog4JServlet log4j-init-file /WEB-INF/log4j-config.xml 1 action org.apache.struts.action.ActionServlet application ApplicationResources config /WEB-INF/struts-config.xml 2 @generated@ ServeImage /ServeImage action /do/* ServletRedirector /ServletRedirector DB Connection jdbc/holmansite javax.sql.DataSource Container index.html javax.servlet.ServletException /Error.jsp http://www.calandva.com/tags/baileys /WEB-INF/tlds/baileys-html.tld oscache.tld /WEB-INF/tlds/oscache.tld

Posted by: Cal


Monday, May 24, 2004 - 2133 hrs

Two questions: 1) Can you provide an example of your ${ant.template.dir}/web.xml ? (I am using freemarker.org for the same). Is it just a @generated@ ? 2) Did you also use struts and run into "_jspx_meth_* (javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) cannot be applied to (org.apache.struts.taglib.*.*Tag,javax.servlet.jsp.PageContext)" as per http://nagoya.apache.org/bugzilla/show_bug.cgi?id=29160

Posted by: Ralf Hauser



The Posting
Friday, October 31, 2003 Tomcat 5.0 Precompile with Struts and Tiles

Adding precompiled jsps with Tomcat 5 is actually pretty easy to bring into the build process.  First the environment - I was trying to precompile jsps built on Struts 1.1 and Tiles.  My previous attempts in Tomcat 3 were foiled by the complexity of the process.  In Tomcat 5 the documentation provides a good example of setting up the Jasper 2 compiler to precompile your application.

The key is to create the exploded WAR and then invoke the jspc and javac on that structure.  Since they both need all the classes, libraries, and jsps.  My development project structure is below.  The Tomcat example does the precompile on the exploded war in the webapps directory - I use a build directory to pull all the items together prior to making a war file.

First you create the servlets - in following the example I placed them in the WEB-INF directory.  Then you compile the servlets and for me they were compiled into the build/classes directory. Next you need to map all the new servlets to the .jsp requests so I replace a token with the generated_web.xml in my web.xml.  This last step makes the build process automated but means your web.xml is built by ant.  I have not included the compile and war targets.

project
-->src           <-- all .java files

-->build
---->classes     <-- all classes including precompiled jsps
---->WEB-INF 
---->META-INF

-->WebRoot
---->web          <-- html/jsp/css/etc
---->META-INF
---->WEB-INF
------>classes    <-- compiled classes from the project/src the real java classes
------>src        <-- used to store the jsp servlets created in jspc target
------>lib

 <target name="jspc">
  <delete dir="${WEB-INF.dir}/src"/>
 <taskdef    name="jasper2"   classname="org.apache.jasper.JspC" >
  <classpath id="jspc.classpath">
  <pathelement location="${java.home}/../lib/tools.jar"/>
  <fileset dir="${my.catalina.home}/server/lib">
   <include name="*.jar"/>
  </fileset>
  <fileset dir="${my.catalina.home}/common/lib">
     <include name="*.jar"/>
  </fileset>
  </classpath>
 </taskdef>
 
 <jasper2
  validateXml="false"
  uriroot="${WebRoot.dir}"
  webXmlFragment="${WEB-INF.dir}/generated_web.xml"
  outputDir="${WEB-INF.dir}/src" />

</target>
<target name="compilejsp">
 
 <javac  destdir="${build.classes.dir}"
     optimize="off"
     debug="on"
     failonerror="false"
     srcdir="${WEB-INF.dir}/src"
     excludes="**/*.smap">
 
 <classpath>
  <pathelement location="${WEB-INF.dir}/classes"/>
  <fileset dir="${WEB-INF.dir}/lib">
   <include name="*.jar"/>
  </fileset>
  <pathelement location="${my.catalina.home}/common/classes"/>
  <fileset dir="${my.catalina.home}/common/lib">
   <include name="*.jar"/>
  </fileset>
  <pathelement location="${my.catalina.home}/shared/classes"/>
  <fileset dir="${my.catalina.home}/shared/lib">
   <include name="*.jar"/>
  </fileset>
 </classpath>
 <include name="**" />
 <exclude name="tags/**" />
</javac>

    </target>

<target name="compile-jsps" depends="init, compile, jspc,compilejsp">
 <loadfile property="file" srcFile="${WEB-INF.dir}/generated_web.xml"/>
 <copy    file="${ant.template.dir}/web.xml"  
  toFile="${WEB-INF.dir}/web.xml"  filtering="on" overwrite="yes">
  <filterset>
   <filter  token="generated"  value="${file}"/>
  </filterset>
 </copy>  
</target>

posted at 1056 hrs



 
 
What's New
02/14 Baileys
02/07 Slideshow
10/20 Wyoming Vaca...
03/30 Mom and Dad ...
11/15 Cal Holman P...

New Pics
Sea the Seals
Going Surfing
Into the Sea
California Beach
Anxious Cal

Popular Pics
1 Baileys and Sweet...
2 Sweetpea and a Mo...
3 Sleepy
4 Vacation in Highl...
5 A Christmas Jacket
6 Washington Hall -...
7 42nd Street Subway
8 Sunrise in Manhattan
9 Little Post Office
10 Radio City at Chr...
11 Dinner in Monteverde
12 Sunrise in Manhattan
13 I Can't Believe Y...
14 Salis IT
15 Cozy Fire

Top Page Hits
1 GuestBook
2 ScrapbookSearch
3 blogging
4 SupportProjects
5


    Top Top    
java struts tomcat log4j DTDns MySQL Ant Apache