简体   繁体   English

如何在Liferay中将钩子添加到Portlet?

[英]How to add hook into portlet in liferay?

I have made a struts action hook and want to add it to the portlet. 我已经制作了一个struts动作钩子,并想将其添加到portlet中。 I tried several things like I made first a portlet plugin project and then tried to add hook into it by right clicking on the portlet project and clicking on New->Liferay Hook Configuration but there is no option of struts action hook there. 我尝试了几种方法,例如首先创建了一个portlet插件项目,然后尝试通过右键单击portlet项目并单击New-> Liferay Hook Configuration将钩子添加到其中,但是那里没有struts action钩子选项。

So I decided to make hook first. 所以我决定先做钩子。 I am now ready with the hook and need to add it to the portlet. 我现在已经准备好使用该钩子,需要将其添加到Portlet中。

How can I achieve it? 我该如何实现? Is there any way to add struts action hook to the portlet? 有什么方法可以将Struts动作钩子添加到Portlet吗?

You need to prefix struts path of the portlet in which you want to add struts action. 您需要在要添加struts操作的portlet的struts路径前面加上前缀。 You can find struts path for Liferay OOTB portlets in /ROOT/WEB-INF/liferay-portlet.xml. 您可以在/ROOT/WEB-INF/liferay-portlet.xml中找到Liferay OOTB portlet的struts路径。

Example: 例:

Consider you want to add new struts action to message boards portlet. 考虑您要向留言板portlet添加新的struts操作。 you have to write struts-action-path in liferay-hook.xml as follow : 您必须在liferay-hook.xml中编写struts-action-path ,如下所示:

<struts-action-path>/message_boards/new_struts_action</struts-action-path>

HTH 高温超导

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

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