Forums de discussion

struts-action path is not working in liferay hook 6.1

Kiran Kumar Boyini, modifié il y a 7 années.

struts-action path is not working in liferay hook 6.1

Expert Publications: 287 Date d'inscription: 02/06/11 Publications récentes
Hi All,

I am trying to user struts-action tag in liferay hook for the announcment portlet.
For this I am using hook in my application.
Please see the code below.
liferay-hook.xml :
<struts-action>
		<struts-action-path>/announcements/edit_entry</struts-action-path>
		<struts-action-impl> com.unisys.vantagepoint.struts.action.AnnouncementEditEntryAction</struts-action-impl>
	</struts-action>

jsp :
function <portlet:namespace />saveEntry() {
document.<portlet:namespace />fm.action = '<portlet:actionurl><portlet:param name="struts_action" value="/announcements/edit_entry" /></portlet:actionurl>';
document.<portlet:namespace />fm.target = '';
document.<portlet:namespace />fm.<portlet:namespace />&lt;%= Constants.CMD %&gt;.value = "&lt;%= (entry == null) ? Constants.ADD : Constants.UPDATE %&gt;";
document.<portlet:namespace />fm.<portlet:namespace />content.value = <portlet:namespace />getContent();
submitForm(document.<portlet:namespace />fm);
}

Java class :

public class AnnouncementEditEntryAction extends PortletAction  {
public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig,ActionRequest actionRequest, ActionResponse actionResponse)
	 		throws Exception {
}
}


after deploy the hook , request is not coming to this java class.i.e., it has to execute process action as per the configuration.

Please let me know anything wrong from my side.

Regards,
Kiran.
thumbnail
Amos Fong, modifié il y a 7 années.

RE: struts-action path is not working in liferay hook 6.1

Liferay Legend Publications: 2047 Date d'inscription: 07/10/08 Publications récentes
Hi Kiran,

Take a look at #4 on this doc:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-1/overriding-and-adding-struts-actions

Make sure your class extends the right class:
public class ExampleStrutsPortletAction extends BaseStrutsPortletAction {