I have a web application deployed as a WAR file in Tomcat 7. The application is built as a multi-module project:
- Core
- packaged as a JAR contains most of the backend code
- core-api - packaged as a JAR, contains interfaces to the kernel
- webapp - packaged as WAR, contains interface code and depends on the kernel
- client extensions - add-on packaged as a JAR
Usually we can put our JSP files in a webapp project and reference them relative to context:
/WEB-INF/jsp/someMagicalPage.jsp
The question is what we are doing with JSP files specific to the client extension project, which should not always be included in the WAR. Unfortunately, I cannot reference JSP inside JAR files, it seems. Trying classpath:jsp/customerMagicalPage.jsp results in the file not being found in JspServlet, as it uses ServletContext.getResource() .
Traditionally, we βsolveβ this when maven unpacks the client extension JARs, hosts the JSP, and puts them in the WAR when it is created. But the ideal situation is that you simply throw the JAR into the exploded WAR in Tomcat and discover an extension - which works for everything except the JSP.
Is there any way to solve this? Standard way, Tomcat way to hack or workaround? For example, I was thinking about unpacking the JSP when the application started ...
java jsp tomcat servlets tiles
waxwing Feb 16 2018-11-11T00: 00Z
source share