Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Sharing JSPs between OSGI modules
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
But when I try to reference a JSP from that taglib project
I understandably get the an error telling me it cannot find the file.
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.
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&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&_practiceprofile_INSTANCE_DJ4CBqI0VPfv_mvcPath=%2Fpracticeprofile%2FppmHome.jsp&_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.
No it is not possible. JSPs are loaded via the class loader, and no two bundles expose them like that.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™