Can I serve JSPs from inside a JAR in lib, or is there a workaround?

Servlet 3.0 which Tomcat 7 supports includes the ability to package jsps into a jar.

You need to:

  • place your jsps in META-INF/resources directory of your jar
  • optionally include a web-fragment.xml in the META-INF directory of your jar
  • place the jar in WEB-INF/lib directory of your war

You should then be able to reference your jsps in your context. For example if you have a jsp META-INF/resources/test.jsp you should be able reference this at the root of your context as test.jsp


Designed by JB FACTORY