>>>>> "Dmitri" == Dmitri Lysenko <[EMAIL PROTECTED]> writes:

    Dmitri> Hi,
    Dmitri> I'm using the tomcat 4.0.3 and I'm looking for the way to avoid the 
    Dmitri> jsp page compilation in runtime. I was about to use the supplied jspc 
    Dmitri> compiler that's included in the distribution. However I shortly found out 
    Dmitri> that it generates the classnames that are different from those generated 
by 
    Dmitri> the runtime jsp compiler. I resolved this problem by subclassing the JspC 
    Dmitri> class and delegating the jsp compilation to the JspCompiler class instead 
of 
    Dmitri> the CommandLineCompiler. As a result I have the java files with the proper 
    Dmitri> names. However I don't see the good way to avoid runtime compilation. Even 
    Dmitri> having the precompiled classes in the webapp's war file the Jasper doesn't 
    Dmitri> use it. It looks the jsp page from the war and tries to find corresponding 
    Dmitri> class in the _work_ directory that's empty initially. Therefore it 
involves 
    Dmitri> the compilation of the source JSP. Is there any way to avoid this 
compilation 
    Dmitri> without populating the tomcat's _work_ directory with the precompiled 
    Dmitri> classes?! What's the right approach to use the JSP precompilation?

I believe the idea is to use the new class names, but to include servlet
mappings for these new class names in the "web.xml" file.

There is an option to "JspC" to specify the name of the file to generate to be
included in the "web.xml" file.  Unfortunately, specifying the include file
doesn't currently work, at least in the nightly build (as of about 2 days ago).
There are at least two different issues preventing it from working.

If you wanted to get this done manually, you could just insert the generated
file into your "web.xml" file, avoiding the include problem.

In case the include problems are fixed soon, here is an excerpt from my
"build.xml" that shows the process.  Note that the root directory of my
application has a "build" directory where I accumulate all the pieces for my
WAR file.  There is also a "jspc" directory where I generate the servlet
classes from the JSP pages.  Note that I'm excluding the jsp pages from the
WAR, as they shouldn't be needed, although as I haven't gotten the includes to
work yet, I haven't verified that yet.

---------------
  <delete dir="jspc"/>
  <mkdir dir="jspc"/>
  <java classname="org.apache.jasper.JspC" fork="yes">
   <arg line="-v -d jspc -p org.apache.jsp -uriroot build
              -webinc build/WEB-INF/webinc.xml -webapp build "/>
   <classpath>
    <pathelement location="${catalina.home}/common/lib/jasper-compiler.jar"/>
    <pathelement location="${catalina.home}/common/lib/jasper-runtime.jar"/>
    <pathelement location="weblib/servlet.jar"/>
   </classpath>
  </java>
  <javac srcdir="jspc" destdir="classes" debug="on" optimize="off"
         deprecation="on">
   <classpath>
    <pathelement location="${catalina.home}/common/lib/jasper-compiler.jar"/>
    <pathelement location="${catalina.home}/common/lib/jasper-runtime.jar"/>
    <fileset dir="weblib">
     <include name="*.jar"/>
    </fileset>
   </classpath>
   <include name="**/*.java"/>
  </javac>
  <copy todir="build/WEB-INF/classes">
   <fileset dir="classes">
    <include name="com/intsoft/strutstest/**/*.class"/>
   </fileset>
  </copy>
  <jar jarfile="deploy/strutstest.war">
   <fileset dir="build">
    <include name="**"/>
    <exclude name="*.jsp"/>
   </fileset>
  </jar>
---------------

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to