sharing common jsp's in multiple wars in an EAR

后端 未结 1 2044
谎友^
谎友^ 2021-02-10 00:17

We have a big application having 13 modules. Depending on the customer requirement, we should able to deploy core module+customer specific modules. We are planning to break the

相关标签:
1条回答
  • 2021-02-10 00:45

    Good question. You'll be happy to hear that the answer is "yes", although it's highly dependent on how your servlet container is configured.

    It's done using the JSTL <c:import> tag, which has an optional context attribute which is defined as:

    Name of the context (beginning with a /) of some other local web application to import the resource from.

    So say you have webapp A deployed under context root /A, and webapp B deployed under /B, then a JSP in A can include x.jsp from B using:

    <c:import context="/B" url="x.jsp"/>
    

    This is all very nice and rosy, but this has to pass through the servlet container's security mechanism, and it may not permit the operation. For example, in Tomcat the crossContext attribute must be set to true.

    0 讨论(0)
提交回复
热议问题