Creating a custom taglib in Liferay 7

我的未来我决定 提交于 2019-12-12 19:57:08

问题


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


回答1:


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}"


来源:https://stackoverflow.com/questions/38522892/creating-a-custom-taglib-in-liferay-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!