Tomcat requires the servlet and servlet mappings in the web.xml, this is
the way it works. Essentially, servlets are generated for the jsp pages.
I modified my web application this week to precompile the jsp files and
no longer include these in my war.
The JspC compiler when used with the -webapp option, also allows the use
of either -webxml or -webinc to generate a complete web.xml file or just
the servlet and servlet mappings to be included. I found I couldnt do
this using the ant jspc command, but rather used a java task to run the
jspc command.
My generated .java classes were then compiled with all my other classes
and put in the war.
Andy.
Thomas Heller wrote:
> hi there,
>
> i am migrating my projects from php to java and began to set up a
> development server that ideally does all the dev work once a project is
> marked release i just call an ant task to deploy the project to one or more
> (load balanced) production servers.
>
> i have written an ant build.xml to compile my webapp and to put everything i
> need into "mywebapp.war". thats working very fine and i can just deploy that
> .war to a tomcat server without any problems.
>
> now, i have setup another ant task to precompile every jsp file using jasper
> (ant task "jspc"). thats working perfectly fine and i have loads of
> index_jsp.java, etc files. now i compile those to .class files and i would
> like to distribute them inside the .war file so that the tomcat server
> itself doesnt need to compile anything by himself. _Ideally_ i'd like to
> exclude _any_ .jsp file in the .war file and just include the compiled
> jsp.class files.
>
> but i wonder ... tomcat somehow doesnt really know what i'm sending him and
> he doesnt recognize any of the precompiled pages. how do i tell tomcat to
> use the precompiled pages in the .war instead of compiling them himself?
>
> i know i can write this it into my web.xml
>
> <servlet>
> <servlet-name>index_jsp</servlet-name>
> <servlet-class>
> my.package.jsp.index_jsp
> </servlet-class>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>index_jsp</servlet-name>
> <url-pattern>/index.jsp</url-pattern>
> </servlet-mapping>
>
> but somehow i dont like it this way, but i would rather use this instead of
> putting jsp files into the .war file. would be cool if tomcat would do
> something like this by himself when he finds *_jsp.class in a
> /WEB-INF/precompiled directory.
>
> Anyways maybe tomcat has some support for what i'm trying to find and i just
> can't find it? Comments welcome
>
> Greetings,
> Thomas
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
>
>
>
--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
|