Hi, I am testing a webapp named 'myWebApp' with Tomcat 5.5. Tomcat is storing all the class files (i.e., the compiled code of jsps) in the directory 'Tomcat 5.5\work\Catalina\localhost\myWebApp'. If I remove the souce jsp pages from 'Tomcat 5.5\webapps\myWebApp', and try to access a page, it is showing the error 'The requested resource (/test/Test.jsp) is not available'
I was able to achieve this with Oracle HTTP server.
How to tell tomcat to run the application from the compiled code ?
You're wanting to used pre-compiled JSP's, and (as you've discovered) it's not as simple as letting them compile by themselves, and just removing the source after.
What's happening is, the JSP servlet (which is mapped to *.jsp) is trying to find the *.jsp file on the filesystem, so that it can compare the date with the date on the classfile. When it's not found, it becomes unhappy.
With precompiled JSPs (which should be done in advance), you need to map each and every *.jsp to the generated servlet class. Your web.xml will contain many more entries than it currently does!
The site appears down, as I post this, so hopefully it will come back up at some time, but here is a step-by-step for Tomcat 5.0.x
In addition to what Mike said I would add why?. Yes, in theory there is a tiny performance hit: every time a JSP is requested the server has to fstat() (or whatever your O/S does) two files and compare the dates. But otherwise there is no performance penalty for leaving the JSP file alone. What is the advantage of removing it?
<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
Joined: Sep 26, 2004
Hi Scott Dunbar,
I want to remove the source JSPs so that others cannot see the actual code. If there is only compiled version, it will have only class files, so others cannot know what exactly is inside the original jsp page.
Is there any other way to hide source code ? (creating a war file can solve this problem ?)