Shubham Aggarwal
Shubham Aggarwal

Reputation: 121

Tomcat JSP Pre-Compilation

I am trying to pre-compile jsp's using curl command. Almost all of the jsps are getting successfully pre-compiled and executed but execution for few of them are failing for some reason. But since, jsp's are already compiled, I believe that the time to serve the request must reduce on first hit and that is not happening in my case. And the second hit is very much faster than the first one. Also, I think that one of the possible reasons could be that tomcat is re-compiling the JSPs if their execution is failed during Pre-Compilation. Is that true? If yes, how to stop re-compilation of a JSP?

Upvotes: 0

Views: 2480

Answers (1)

Tim Funk
Tim Funk

Reputation: 879

There is a precompile option during build time. This can allow you to turn the jsp's into servlet and map them in web.xml. Then you don't even need to deploy the jsp files (since they are compiled into servlets already and mapped in web.xml)

For example: Here's a blog talking about it with maven https://tcollignon.github.io/2016/12/04/How-to-compile-JSP-with-Tomcat-and-Maven-faster.html

you can do this via ant via org.apache.jasper.JspC

Upvotes: 1

Related Questions