Foren

Struts Portlet Action not working

thumbnail
Andew Jardine, geändert vor 9 Jahren.

Struts Portlet Action not working

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hey Guys,

Must be something simple that I am missing -- I've done this before on other project, but with other versions of Liferay. My Environment:

+ Liferay 6.2 EE
+ Tomcat
+ Maven project.


My liferay-hook.xml


<!--?xml version="1.0"?-->


<hook>
	<portal-properties>portal.properties</portal-properties>
	<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
    <struts-action>
        <struts-action-path>/admin/edit_instance</struts-action-path>
        <struts-action-impl>com.xxx.shared.liferay.portlet.admin.action.CustomEditInstanceAction</struts-action-impl>
    </struts-action>
</hook>



My CustomEditInstanceAction class...



package com.xxx.shared.liferay.portlet.admin.action;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;

import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.struts.BaseStrutsPortletAction;
import com.liferay.portal.kernel.struts.StrutsPortletAction;

public class CustomEditInstanceAction extends BaseStrutsPortletAction 
{
	private static final Log _log = LogFactoryUtil.getLog( CustomEditInstanceAction.class );

	@Override
	public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception
	{
		// TODO Auto-generated method stub
		_log.info("*** 1");
	}

	@Override
	public String render(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception
	{
		_log.info("*** 2");
		return originalStrutsPortletAction.render(originalStrutsPortletAction, portletConfig, renderRequest, renderResponse);
	}


	@Override
	public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception
	{
		// TODO Auto-generated method stub
		_log.info("*** 3");
		
	}


	@Override
	public String render(PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception
	{
		_log.info("*** 4");
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void serveResource(PortletConfig portletConfig, ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception
	{
		_log.info("*** 5");
		// TODO Auto-generated method stub
		
	}

	@Override
	public void serveResource(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception
	{
		_log.info("*** 6");
		// TODO Auto-generated method stub
		
	}
}


I've also tried doing implementing the interface class instead of extending the BaseStrutsPortletAction -- but no dice. The deploy seems to work, no errors reported anyway but when I go to the Control Panel > Portal Instances > Add ... I don't see any log statements. I also don't see any statements when I fill in teh form and hit the "save" button.

Thoughts anyone?
thumbnail
Andew Jardine, geändert vor 9 Jahren.

RE: Struts Portlet Action not working

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hah! got it. Wrong mapping. For what I am trying to do, I should be using --


<!--?xml version="1.0"?-->


<hook>
	<portal-properties>portal.properties</portal-properties>
	<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
    <struts-action>
        <struts-action-path>/admin_instances/edit_instance</struts-action-path>
        <struts-action-impl>com.ypg.shared.liferay.portlet.admin.action.YpgEditInstanceAction</struts-action-impl>
    </struts-action>  
</hook>
thumbnail
Satyanarayana kolliboyin, geändert vor 8 Jahren.

RE: Struts Portlet Action not working

Junior Member Beiträge: 26 Beitrittsdatum: 23.06.10 Neueste Beiträge
Hi All,

I am planning to customize liferay's server administration --> resources functionalities. Hence I am trying to customize (/admin/edit_server) struts path. Its not working at all. Finally, we found that to customize liferay's server administration, we need to customize (/admin_server/edit_server) struts path.
Present, its working fine.

Wrong entries under liferay-hook.xml to customize liferay's server administration --> resources:

<struts-action>
<struts-action-path>/admin/edit_server</struts-action-path>
<struts-action-impl>
com.competency.portal.action.CustomEditServerAction
</struts-action-impl>
</struts-action>
Correct entries under liferay-hook.xml to customize liferay's server administration --> resources:

<struts-action>
<struts-action-path>/admin_server/edit_server</struts-action-path>
<struts-action-impl>
com.competency.portal.action.CustomEditServerAction
</struts-action-impl>
</struts-action>