在Liferay 7中创建自定义标签库 [英] Creating a custom taglib in Liferay 7

查看:89
本文介绍了在Liferay 7中创建自定义标签库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Liferay 7和OSGi模块对应用程序进行编码.我需要创建一个在所有模块(portlet)中都可用的自定义taglib,但是我完全不知道从哪里开始.

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.

你有什么主意吗?

我应该在OSGi模块中存储taglib定义,类和JSP吗?如果没有,我该如何在Portlet模块中引用它?

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?

非常感谢您

推荐答案

在大多数情况下,您应该能够在OSGi模块内完全交付taglib.您可以在Liferay的源代码中找到一些完成此操作的示例,例如:

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. com/liferay/liferay-portal/tree/master/modules/apps/foundation/map/map-taglib

在该示例中可以看到,可以使用bnd.bnd文件中的Provide-Capability声明模块将导出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}"

这篇关于在Liferay 7中创建自定义标签库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆