我正在使用 Liferay 7 和 OSGi 模块编写一个应用程序。我需要创建一个跨所有模块(portlet)可用的自定义标签库,但我几乎不知道从哪里开始。
你有什么主意吗?
我应该将 taglib 定义、类和 JSP 存储在 OSGi 模块中吗?如果没有,在哪里以及如何从 portlet 模块引用它?
非常感谢
在大多数情况下,您应该能够在 OSGi 模块中完全交付 taglib。您可以在 Liferay 的源代码中找到几个完成此操作的示例,如下所示:
https://github.com/liferay/liferay-portal/tree/master/modules/apps/foundation/map/map-taglib https://github.com/liferay/liferay-portal/tree/master/modules/apps/foundation/map/map-taglib
正如您在该示例中看到的,您可以声明该模块将通过在 bnd.bnd 文件中使用 Provide-Capability 导出 taglib:
Provide-Capability: osgi.extender;osgi.extender="jsp.taglib";uri="http://liferay.com/tld/map";version:Version="${Bundle-Version}"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)