Creating a custom taglib in Liferay 7
Asked Answered
V

1

2

I am coding an application using Liferay 7 and OSGi modules. I need to create a custom taglib available across all modules (portlets), but I have litteraly no idea where to start.

Do you have any idea?

Should I store the taglib definition, classes and JSPs in an OSGi modules? And if not, where, and how can I reference it from a portlet module?

Thank you very much

Viridity answered 22/7, 2016 at 9:27 Comment(0)
R
4

In most cases you should be able to deliver a taglib completely within an OSGi module. You can find several examples in Liferay's source code where this is done, such as the following:

https://github.com/liferay/liferay-portal/tree/master/modules/apps/foundation/map/map-taglib

As you can see in that example, you can declare that the module will export the taglib by using Provide-Capability in the bnd.bnd file:

Provide-Capability: osgi.extender;osgi.extender="jsp.taglib";uri="http://liferay.com/tld/map";version:Version="${Bundle-Version}"
Rosellaroselle answered 25/7, 2016 at 20:13 Comment(2)
does this mechanism work to overwrite core taglib classes ?Mild
broken link ...Revoke

© 2022 - 2024 — McMap. All rights reserved.