Message Boards

Sharing JSPs between OSGI modules

Kevin Neibarger, modified 5 Years ago.

Sharing JSPs between OSGI modules

Regular Member Posts: 105 Join Date: 2/2/18 Recent Posts
I currently have two OSGI modules in a Liferay IDE project, one is a web module that contains CSS, JSPs, etc. I also have a module that defines custom JSP Tags. I don't know if it's possible, but I'd like to reference the JSPs from the web module in the custom TAG module. 

The web module already has the taglib module as a dependency in it's build.gradle

compileOnly project(':my-portlet-taglib')

But when I try to reference a JSP from that taglib project 


<div id="<portlet:namespace/>tabs-1">

  <jsp:include page="/practiceprofile/practiceprofilesections/generalInformationSection.jsp" />

  </div>

I understandably get the an error telling me it cannot find the file.

2019-03-18 13:55:52.303 ERROR [http-nio-8080-exec-2][IncludeTag:128] Current URL /web/healthmap/practices?p_p_id=practiceprofile_INSTANCE_DJ4CBqI0VPfv&amp;p_p_lifecycle=0&amp;p_p_state=normal&amp;p_p_mode=view&amp;_practiceprofile_INSTANCE_DJ4CBqI0VPfv_mvcPath=%2Fpracticeprofile%2FppmHome.jsp&amp;_practiceprofile_INSTANCE_DJ4CBqI0VPfv_practiceId=205 generates exception: /practiceprofile/practiceprofilesections/generalInformationSection.jsp

java.io.FileNotFoundException: /practiceprofile/practiceprofilesections/generalInformationSection.jsp


How can I make this file visible from the web module? The other option would be to move all of these JSPs to the taglib project but I'd rather have all the JSPs in the web module. It makes more sense that way. 
thumbnail
David H Nebinger, modified 5 Years ago.

RE: Sharing JSPs between OSGI modules

Liferay Legend Posts: 14919 Join Date: 9/2/06 Recent Posts
No it is not possible. JSPs are loaded via the class loader, and no two bundles expose them like that.