掲示板

handle errors inside BaseStrutsPortletAction

7年前 に Fabrizio Attanasio によって更新されました。

handle errors inside BaseStrutsPortletAction

Junior Member 投稿: 54 参加年月日: 16/01/29 最新の投稿
Hello to all,
I implemented a hook for user creation. The flow is as follows:

- fill out the form jsp
- Join in the custom action, and here I make a call to an external service to check things. Also save data to an external database.
- The action continues with the originalStrutsPortletAction.processAction(originalStrutsPortletAction, portletConfig, actionRequest, actionResponse);
- At this point if there are any problems during validation (as check captcha text) I would like to make a rollback calling an external service to delete saved data on the external database.
How do I know that there were errors during the processAction?

Thank you,
Fabrizio
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: handle errors inside BaseStrutsPortletAction

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
1. surround call with try/catch block.
2. check the SessionErrors object to see if any errors were added in the call to original struts portlet action.

In either case something was flagged that should trigger your cleanup code.
7年前 に Fabrizio Attanasio によって更新されました。

RE: handle errors inside BaseStrutsPortletAction

Junior Member 投稿: 54 参加年月日: 16/01/29 最新の投稿
Thank you. I resolved with

if(SessionErrors.size(actionRequest)>0){
rollback etc...
}

Bye bye !