Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Andew Jardine
Overriding Create Account action?
September 30, 2013 9:24 AM
Answer

Andew Jardine

Rank: Expert

Posts: 353

Join Date: December 22, 2010

Recent Posts

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

1
2<hook>
3    <custom-jsp-dir>/custom_jsps</custom-jsp-dir>
4    <struts-action>
5        <struts-action-path>/portal/login/create_account</struts-action-path>
6        <struts-action-impl>com.xxx.liferay.auth.login.action.xxxCreateAccountAction</struts-action-impl>
7    </struts-action>   
8</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?
Andew Jardine
RE: Overriding Create Account action?
September 30, 2013 10:57 AM
Answer

Andew Jardine

Rank: Expert

Posts: 353

Join Date: December 22, 2010

Recent Posts

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.