问题描述:

I have a test WAR file that I generated from source. When I unzip the WAR file I see that the Java classes were compiled to .class files, but the .jsp files were not compiled. I understand this is done at runtime and the .jsp files are eventually converted to .class files.

I developed my WAR file in Tomcat7. I realize this is an odd question. The end goal is to develop a static analysis tool which runs on class files (I cannot read jsp files).

I've read that I can optimize the WAR file and precompile the JSP files into a JAR file that is nested in the WAR file, but I can't figure out how to do it. I'd like to find or create a utility that takes an unoptimized WAR file and generates the JSP class files.

网友答案:

Yes, JSPs are normally generated on the fly. In Tomcat, it is done by the Jasper JSP engine.

It is possible to pre-compile them. This article might help: How to pre-compile JSP

It describes how to trigger the pre-compilation from the command line and includes an example Ant file.

相关阅读:
Top