include module templates

Would it be possible to include a jsp from another module

Question

Would it be possible to include a jsp from another module?

Answer

It is NOT possible with jsp:include tag because it does a new request, and in this request jahia is not initialized, so it will not work, you will always get the error that the component.jsp cannot be found.

But another solution which is working is to use views, means the jsp in the other module is a custom view of the current component. In this case, you could use the template:module tag. E.g.: In the first module where you do the include, you have to add with template:module tag the new view (in example it is the news component): 

<template:module node="${currentNode}" view="view1" /> 

In the second module, you need a jnt_news/html/news.view1.jsp (view1 should be a unique view name).

NOTE: You cannot pass parameters to this jsp, but you can set jstl variables with the right scope, for instance define a variable like: 

<c:set var="tata" value="toto" scope="request" /> 

and in the news.view1.jsp you can use it like

${tata}