简体   繁体   English

使用Spring MVC和Maven在liferay中自定义Taglib?

[英]Custom Taglib in liferay using Spring MVC & Maven?

How do i proceed with creating a custom Taglib in a liferay .For now i have a portlet created in place. 我如何继续在liferay创建自定义Taglib 。现在,我已经在适当的位置创建了portlet My obvious questions are: 我的明显问题是:

  1. Do i need to create a hook plugin and override a jsp for acheiving this target? 我是否需要创建一个hook plugin并覆盖一个jsp来实现此目标?
  2. Do i need to download any jars ? 我需要下载任何jars吗?
  3. Which all files would require changes? 哪些所有文件都需要更改?

I didnt find sufficient source for achieving this. 我没有找到足够的资源来实现这一目标。 Any guidance much appreciated. 任何指导表示赞赏。 Thanks. 谢谢。

You're using a custom taglib in your own portlet just like you'd use it in any other web application: Include the TLD and the jar with the taglib's implementation, then include it in the JSPs that you're using in your portlets. 您在自己的Portlet中使用自定义taglib就像在其他任何Web应用程序中使用它一样:将TLD和jar包含在taglib的实现中,然后将其包含在您在Portlet中使用的JSP中。

If you want to override Liferay's JSPs with your own JSP implementations (in a hook), you're typically limited to Liferay's own JSPs: A hook can't introduce a new Taglibrary to Liferay. 如果您用自己的JSP实现(在一个挂钩中)覆盖Liferay的JSP,则通常仅限于Liferay自己的JSP:挂钩无法为Liferay引入新的Taglibrary。 However, if absolutely necessary you can add a custom taglib to Liferay with an ext plugin and use it from a hook. 但是,如果绝对必要,则可以使用ext插件向Liferay添加自定义taglib,并从钩子中使用它。

But note that this has nothing to do with what's available to a portlet plugin: Portlet plugins are completely self-contained and can introduce whatever taglib they want with no need to customize Liferay itself. 但是请注意,这与Portlet插件的功能无关:Portlet插件是完全独立的,可以引入所需的任何标签库,而无需自定义Liferay本身。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM