Wednesday, August 09, 2006

Spring (JstlView) and Tomcat ignoring precompiled JSPs

I had a problem with precompiled JSPs that made me think that it was due to the use of Spring MVC. Basically, after precompiling and inserting web.xml fragment generated by jspc tomcat task, I still could see the work dir full of Java generated source code and their classes. What did it mean? Tomcat was ignoring completely my precompiled JSPs.

After checking Spring code, I noticed a subtle thing that caused this error. A double slash maded all this mess. For example, instead of having


I had


because my view resolver had been set with prefix "/web/WEB-INF/pages/", suffix ".jsp" and the view name was being set as "/index". For this reason, Tomcat did not find a servlet mapping and ended up generating a new Java file for the JSP and compiling it on demand.

I don't know yet if this should be handled by Spring view resolver, but check if this is your case (and you are facing the same problem).
Post a Comment