简体   繁体   中英

How to add hook into portlet in liferay?

I have made a struts action hook and want to add it to the 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.

So I decided to make hook first. I am now ready with the hook and need to add it to the portlet.

How can I achieve it? Is there any way to add struts action hook to the portlet?

You need to prefix struts path of the portlet in which you want to add struts action. You can find struts path for Liferay OOTB portlets in /ROOT/WEB-INF/liferay-portlet.xml.

Example:

Consider you want to add new struts action to message boards portlet. you have to write struts-action-path in liferay-hook.xml as follow :

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

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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