JSP pages should be precompiled before deployment in any environment. The reason for this is two fold.

  1. The first reason is that you discover any compilation problems before going through the deployment of the code into the container. This reason gets greater weight the longer it takes for the deployment. You wouldn’t put .java files into an environment without knowing that they compile, so why would you just because it ends in .jsp?
  2. The second reason is performance immediately after deployment. The first impression users will have of your latest and greatest code right after it deploys is how slowly the pages render while the server is compiling the jsps into class files. Generally this is not the impression you want your users to have. Yes, precompilation adds to the build time, but given where that time is taken from, it is well worth it.

Unfortunately there is no standard way to do this across all containers, but from a quick search showed me how to do for the handful that I could think of including sample ant targets. I find it amazing that this is not common practice given the ease of implementation and the payoff.

For an ‘expert’ opinion that echoes mine, see More JSP Best Practices (at the bottom and continued on the next page).