Foren

Overriding Create Account action?

thumbnail
Andew Jardine, geändert vor 10 Jahren.

Overriding Create Account action?

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

I swear I had this working but myabe I am confusing this with something else. Here is what I have --

1. A hook project xxx-create-account-hook that has the following in the liferay-hook.xml


<hook>
	<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
    <struts-action>
        <struts-action-path>/portal/login/create_account</struts-action-path>
        <struts-action-impl>com.xxx.liferay.auth.login.action.xxxCreateAccountAction</struts-action-impl>
    </struts-action>	
</hook>


First. The action-path is not the same as the struts-config for Liferay. Mine includes /portal at the front but if I don't include it I get a "forward path not found" in my log and the page is returned blank.

With /portal included, the custom JSP shows correctly with my fields in place of the ones used by the portal by default. I fill the form in, hit submit and received an exception in the log referencintg the ContactBirthdayException --- but a birhtday is not on my form. My Action handler (xxxCreateAccountAction) does not check or throw an exception for bithdates. In fact, right now I just have a loggign statement to validate that the class is invoked.

Since I am referencing t aportal level struts action, my Action class is implementing the StrutsPortletAction.

What am I doing wrong?
thumbnail
Andew Jardine, geändert vor 10 Jahren.

RE: Overriding Create Account action? (Antwort)

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Figured it out. /logn/create_account maps to CreateAccountAction which extends PortletAction. This means that I have to IMPLEMENTS the StrutsPortletAction interface in my hook. In order to get my JSP to render (and not get the forward does not exist error) I needed to set the render() method with the originalStrutsPortletAction method to return originalStrutsPortletAction.render(...) . That allowed the original logic to look up my modified JSP page and return it.

The processAction method (also with the originalStrutsPortalAction param) is teh one invoked when you hit the save button on the create_account form.