Tomcat Compiler From JSP to classes

B

Berlin Brown

Does anybody know off hand which API tomcat uses to Compile JSP pages
to .classes. I want to implement a similar mechanism where I parse a
script file, then it outputs to java and then to .class java bytecode.
I will look through the source, but I was just curious. It is probably
the default java compiler, but of course the jakarta people probably
put some special wrappers over it?
 
R

Ryan Stewart

Berlin Brown said:
Does anybody know off hand which API tomcat uses to Compile JSP pages
to .classes. I want to implement a similar mechanism where I parse a
script file, then it outputs to java and then to .class java bytecode.
I will look through the source, but I was just curious. It is probably
the default java compiler, but of course the jakarta people probably
put some special wrappers over it?
Jasper translates JSPs to servlets, javac compiles it. See
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jasper-howto.html
 
G

gimme_this_gimme_that

Look in the tomcat docs for JikesJavaCompiler.html
and JavaCompiler.html.

To make tomcat use jikes, for example, you'd need a dot profile entry
of

export JIKESPATH=.:$JAVA_HOME/jre/lib/rt.jar

your web.xml would has to have an entry like :

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>WARNING</param-value>
</init-param>
<init-param>
<param-name>jspCompilerPlugin</param-name>

<param-value>org.apache.jasper.compiler.JikesJavaCompiler</param-value>
</init-param>
<init-param>
<param-name>classpath</param-name>
<param-value>/usr/j2sdk1_3_1_07/jre/lib/rt.jar</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top