By gaudette
I have figured out the problem with making jsp changes appear, and learned a good deal about jsp compilation.
There is a component of tomcat called Jasper that is responsible for dynamically compiling jsp pages. In its default settings (“development” mode), it checks a jsp everytime it is loaded to see if it has changed since last compiled. If it has, it recompiles it. These are the java classes that show up in $tomcat/work/. The settings for this are in the $tomcat/conf/web.xml file, in the <servlet-name>jsp</servlet-
However, most of the jsps used in blackboard are precompiled. This means that the class files are distributed with the application, and rather than have tomcat compile the JSPs automatically there is a servlet mapping for the jsp name to the java class that came with the app. Tomcat does not even look at the jsps in this case, the request is handled directly by the java class according to the mapping. The jsp and java files like top_frame.jsp and top_frame.java are just byproducts of the compilation, we’re lucky they are there at all. This precompilation process is also responsible for the generated_web.xml file. It contained the servlet mappings for each of the precompiled jsps, and at the end of the compilation process is included in the actual web.xml.
So, the right way to fix this would be to use ant’s JSPC task to recompile the modified jsps according to the same method blackboard would have used to compile it. I know little about ant and setting it up seemed like a nightmare. The second best way would probably be to modify the .java file (which was created as an intermediate step in the compilation) and use javac to compile it. However, I couldn’t seem to get the classpath right, so I kept getting all sorts of compile errors and gave up (eventually I suppose we could get it accomplished).
So what I’ve actually done is commented out the servlet mapping for top_frame.jsp and top_frame_small.jsp, so that rather than using the precompiled classes it compiles them dynamically like an ordinary jsp. Every time the page is loaded, it checks the date on the class file in $tomcat/work against the date on the jsp to see if it needs to be recompiled. This incurs some overhead, probably not much but then again this is a frame that will likely get loaded on just about every page view. What I had hoped to do was take the resulting class file out of the work directory, put it in with the other precompiled classes and replace the servlet mappings. However, this caused an error because when tomcat compiles the class itself it changes the package hierarchy from com/blackboard/whatever/class to org/apache/tomcat/jsp/top_frame.class.
The upside of keeping it dynamic, of course, is that any future modifications will take effect immediately.