Embedding Jasper

Jasper is the JSP compiler inside Tomcat. For reasons, mainly of curiosity, I wanted to build a Pragmatach plugin which exposes Jasper.  Pragmatach supports some template engines such as FreeMarker, ThymeLeaf and Velocity, but I thought Jasper would be a good addition.

I chose to use Tomcat 6, mainly because Tomcat 7 uses Servlet 3.0.  Pragmatach is currently on Servlet 2.5 .   Luckily, there is a really helpful example of compiling JSPs right inside Tomcat; the JspC shell.  JspC is a simple command-line executable which can consume jsp files and produce both .java files and .class files.

The code I ended up with, is here.

Leave a Reply