Fórum

struts-action path is not working in liferay hook 6.1

Kiran Kumar Boyini, modificado 7 Anos atrás.

struts-action path is not working in liferay hook 6.1

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
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, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 2047 Data de Entrada: 07/10/08 Postagens Recentes
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 {